0
private Task<Void> getTransferId = new Task<Void>() {
@Override
protected Void call() throws Exception {
Client client = ClientBuilder.newClient();
WebTarget webTarget = client.target(Constants.BASE_URL);
WebTarget helloworldWebTarget = webTarget.path(Constants.TRANSFER_FILE);
System.out.println(" checking working.....status");
Invocation.Builder invocationBuilder = helloworldWebTarget.request(MediaType.APPLICATION_JSON);
PostFileLog fileLog = new PostFileLog();
fileLog.setSenderId(myUuid);
fileLog.setReceiverId(clickedPossitionUuid);
fileLog.setFileName(fileName);
fileLog.setFileType(fileTypeInt);
fileLog.setFileSize(fileSizeFinal);
fileLog.setStatus(Constants.STATUS_PENDING);
fileLog.setFileDesc(Constants.NO_CAPTION);
Response response = invocationBuilder.post(Entity.entity(fileLog, MediaType.APPLICATION_JSON));
int status = response.getStatus();
PostFileLog reponceLog = response.readEntity(PostFileLog.class);
transferId = reponceLog.getUuid();
System.out.println(transferId + " fist sending TrasferId andstastus " + status);
return null;
}
};
私は上記のコードを実行するために、.run();
を1回だけ実行しています。この問題を解決する方法は何ですか?javafxで継続的に実行されているタスク?
を」編集whileループを停止する方法を確認します。 ''これは、バックグラウンドスレッドでタスクを実行しません。現在のスレッド(FXアプリケーションスレッド、おそらくどこから呼び出すかによって異なります)でタスクを実行します。 'Thread'でラップし、スレッド上で' start() 'を呼び出すか、適切な' Executor'にそれを渡す必要があります。 –