List of usage examples for java.util Timer schedule
public void schedule(TimerTask task, Date time)
From source file:org.eclipse.jubula.client.core.ClientTestImpl.java
/** * creating the job that is building and writing test data to DB. * @param result The test results // w w w . j ava 2 s . co m */ private void createReportJob(final TestResult result) { final AtomicBoolean ab = new AtomicBoolean(false); final Job job = new Job(Messages.ClientCollectingInformation) { private String m_jobFamily = this.getName(); public boolean belongsTo(Object family) { return m_jobFamily.equals(family); } protected IStatus run(IProgressMonitor monitor) { try { monitor.beginTask(Messages.ClientWritingReportToDB, IProgressMonitor.UNKNOWN); ITestResultSummaryPO summary = writeTestresultToDB(result); if (m_logPath != null) { monitor.beginTask(Messages.ClientWritingReport, IProgressMonitor.UNKNOWN); writeReportToFileSystem(result); } if (isRunningWithMonitoring()) { monitor.setTaskName(Messages.ClientCalculating); getMonitoringData(); while (result.getMonitoringValues() == null || result.getMonitoringValues().isEmpty()) { TimeUtil.delay(500); if (result.getMonitoringValues() != null) { break; } if (monitor.isCanceled()) { return Status.CANCEL_STATUS; } } monitor.setTaskName(Messages.ClientBuildingReport); buildMonitoringReport(); while (result.getReportData() == null) { TimeUtil.delay(500); if (result.getReportData() == (MonitoringConstants.EMPTY_REPORT)) { break; } if (monitor.isCanceled()) { return Status.CANCEL_STATUS; } } writeMonitoringResults(result); } DataEventDispatcher.getInstance().fireTestresultSummaryChanged(summary, DataState.Added); monitor.done(); return Status.OK_STATUS; } catch (Throwable t) { // this is due that everything that happens in the job // will otherwise not be logged (like memory Exception) log.error(Messages.ClientWritingReportError, t); return Status.CANCEL_STATUS; } } }; job.addJobChangeListener(new JobChangeAdapter() { public void done(IJobChangeEvent event) { ab.set(true); } }); final Timer timerTimeout = new Timer(); timerTimeout.schedule(new TimerTask() { public void run() { job.cancel(); timerTimeout.cancel(); } }, BUILD_REPORT_TIMEOUT); job.setPriority(Job.LONG); job.schedule(); while (!ab.get()) { TimeUtil.delay(200); } }
From source file:org.eclipse.jubula.client.core.ClientTest.java
/** * creating the job that is building and writing test data to DB. * @param result The test results /*w w w.ja v a 2 s. c om*/ */ private void createReportJob(final TestResult result) { final AtomicBoolean ab = new AtomicBoolean(false); final Job job = new Job(Messages.ClientCollectingInformation) { private String m_jobFamily = this.getName(); public boolean belongsTo(Object family) { return m_jobFamily.equals(family); } protected IStatus run(IProgressMonitor monitor) { try { monitor.beginTask(Messages.ClientWritingReportToDB, IProgressMonitor.UNKNOWN); ITestResultSummaryPO summary = writeTestresultToDB(result); monitor.beginTask(Messages.ClientWritingReport, IProgressMonitor.UNKNOWN); writeReportToFileSystem(result); if (isRunningWithMonitoring()) { monitor.setTaskName(Messages.ClientCalculating); getMonitoringData(); while (result.getMonitoringValues() == null || result.getMonitoringValues().isEmpty()) { TimeUtil.delay(500); if (result.getMonitoringValues() != null) { break; } if (monitor.isCanceled()) { return Status.CANCEL_STATUS; } } monitor.setTaskName(Messages.ClientBuildingReport); buildMonitoringReport(); while (result.getReportData() == null) { TimeUtil.delay(500); if (result.getReportData() == (MonitoringConstants.EMPTY_REPORT)) { break; } if (monitor.isCanceled()) { return Status.CANCEL_STATUS; } } writeMonitoringResults(result); } DataEventDispatcher.getInstance().fireTestresultSummaryChanged(summary, DataState.Added); monitor.done(); return Status.OK_STATUS; } catch (Throwable t) { // this is due that everything that happens in the job // will otherwise not be logged (like memory Exception) log.error(Messages.ClientWritingReportError, t); return Status.CANCEL_STATUS; } } }; job.addJobChangeListener(new JobChangeAdapter() { public void done(IJobChangeEvent event) { ab.set(true); } }); final Timer timerTimeout = new Timer(); timerTimeout.schedule(new TimerTask() { public void run() { job.cancel(); timerTimeout.cancel(); } }, BUILD_REPORT_TIMEOUT); job.setPriority(Job.LONG); job.schedule(); while (!ab.get()) { TimeUtil.delay(200); } }
From source file:de.thm.arsnova.services.QuestionService.java
@Override @PreAuthorize("isAuthenticated() and hasPermission(#questionId, 'question', 'owner')") public void startNewPiRoundDelayed(final String questionId, final int time) { final Timer timer = new Timer(); final Date date = new Date(); final Date endDate = new Date(date.getTime() + (time * 1000)); final IQuestionService questionService = this; final User user = userService.getCurrentUser(); final Question question = databaseDao.getQuestion(questionId); final Session session = databaseDao.getSessionFromKeyword(question.getSessionKeyword()); cancelDelayedPiRoundChange(questionId); timer.schedule(new TimerTask() { @Override//w w w . j a v a2 s . c o m public void run() { questionService.startNewPiRound(questionId, user); } }, endDate); timerList.put(questionId, timer); question.setPiRoundActive(true); question.setPiRoundStartTime(date.getTime()); question.setPiRoundEndTime(endDate.getTime()); update(question); this.publisher.publishEvent(new PiRoundDelayedStartEvent(this, session, question)); }
From source file:com.jredrain.startup.AgentProcessor.java
@Override public Response execute(final Request request) throws TException { if (!this.password.equalsIgnoreCase(request.getPassword())) { return errorPasswordResponse(request); }//from w ww .ja v a 2 s. co m String command = request.getParams().get("command") + EXITCODE_SCRIPT; String pid = request.getParams().get("pid"); //?? Long timeout = CommonUtils.toLong(request.getParams().get("timeout"), 0L); boolean timeoutFlag = timeout > 0; logger.info("[redrain]:execute:{},pid:{}", command, pid); File shellFile = CommandUtils.createShellFile(command, pid); Integer exitValue; ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); final Response response = Response.response(request); final ExecuteWatchdog watchdog = new ExecuteWatchdog(Integer.MAX_VALUE); final Timer timer = new Timer(); DefaultExecuteResultHandler resultHandler = new DefaultExecuteResultHandler(); try { CommandLine commandLine = CommandLine.parse("/bin/bash +x " + shellFile.getAbsolutePath()); final DefaultExecutor executor = new DefaultExecutor(); ExecuteStreamHandler stream = new PumpStreamHandler(outputStream, outputStream); executor.setStreamHandler(stream); response.setStartTime(new Date().getTime()); //?0,shell executor.setExitValue(0); if (timeoutFlag) { //... executor.setWatchdog(watchdog); // timer.schedule(new TimerTask() { @Override public void run() { //,kill... if (watchdog.isWatching()) { /** * watchdogdestroyProcesskill... * watchdog.destroyProcess(); */ timer.cancel(); watchdog.stop(); //call kill... request.setAction(Action.KILL); try { kill(request); response.setExitCode(RedRain.StatusCode.TIME_OUT.getValue()); } catch (TException e) { e.printStackTrace(); } } } }, timeout * 60 * 1000); // resultHandler = new DefaultExecuteResultHandler() { @Override public void onProcessComplete(int exitValue) { super.onProcessComplete(exitValue); timer.cancel(); } @Override public void onProcessFailed(ExecuteException e) { super.onProcessFailed(e); timer.cancel(); } }; } executor.execute(commandLine, resultHandler); resultHandler.waitFor(); } catch (Exception e) { if (e instanceof ExecuteException) { exitValue = ((ExecuteException) e).getExitValue(); } else { exitValue = RedRain.StatusCode.ERROR_EXEC.getValue(); } if (RedRain.StatusCode.KILL.getValue().equals(exitValue)) { if (timeoutFlag) { timer.cancel(); watchdog.stop(); } logger.info("[redrain]:job has be killed!at pid :{}", request.getParams().get("pid")); } else { logger.info("[redrain]:job execute error:{}", e.getCause().getMessage()); } } finally { exitValue = resultHandler.getExitValue(); if (CommonUtils.notEmpty(outputStream.toByteArray())) { try { outputStream.flush(); String text = outputStream.toString(); if (notEmpty(text)) { try { text = text.replaceAll(String.format(REPLACE_REX, shellFile.getAbsolutePath()), ""); response.setMessage(text.substring(0, text.lastIndexOf(EXITCODE_KEY))); exitValue = Integer.parseInt(text .substring(text.lastIndexOf(EXITCODE_KEY) + EXITCODE_KEY.length() + 1).trim()); } catch (IndexOutOfBoundsException e) { response.setMessage(text); } } outputStream.close(); } catch (Exception e) { logger.error("[redrain]:error:{}", e); } } if (RedRain.StatusCode.TIME_OUT.getValue() == response.getExitCode()) { response.setSuccess(false).end(); } else { response.setExitCode(exitValue) .setSuccess(response.getExitCode() == RedRain.StatusCode.SUCCESS_EXIT.getValue()).end(); } if (shellFile != null) { shellFile.delete();// } } logger.info("[redrain]:execute result:{}", response.toString()); watchdog.stop(); return response; }
From source file:org.wso2.emm.system.service.api.OTAServerManager.java
/** * Downloads the property list from remote site, and parse it to property list. * The caller can parse this list and get information. *//* w w w.j a va 2 s . c om*/ public void getTargetPackagePropertyList(final URL url) { final String operation = Preference.getBoolean(context, context.getResources().getString(R.string.firmware_status_check_in_progress)) ? Constants.Operation.GET_FIRMWARE_UPGRADE_PACKAGE_STATUS : Constants.Operation.UPGRADE_FIRMWARE; if (asyncTask != null) { asyncTask.cancel(true); } asyncTask = new AsyncTask<Void, Void, Void>() { protected Void doInBackground(Void... param) { InputStream reader = null; ByteArrayOutputStream writer = null; BuildPropParser parser = null; final int bufSize = 1024; // First, trying to download the property list file. the build.prop of target image. try { URLConnection urlConnection; /* Use the URL configuration to open a connection to the OTA server */ urlConnection = url.openConnection(); urlConnection.setConnectTimeout(Constants.FIRMWARE_UPGRADE_CONNECTIVITY_TIMEOUT); urlConnection.setReadTimeout(Constants.FIRMWARE_UPGRADE_READ_TIMEOUT); /* Since you get a URLConnection, use it to get the InputStream */ reader = urlConnection.getInputStream(); /* Now that the InputStream is open, get the content length */ final int contentLength = urlConnection.getContentLength(); byte[] buffer = new byte[bufSize]; if (contentLength != -1) { writer = new ByteArrayOutputStream(contentLength); } else { writer = new ByteArrayOutputStream(DEFAULT_STREAM_LENGTH); } int totalBufRead = 0; int bytesRead; Timer timer = new Timer(); Log.d(TAG, "Start download: " + url.toString() + " to buffer"); while ((bytesRead = reader.read(buffer)) > 0) { // Write current segment into byte output stream writer.write(buffer, 0, bytesRead); Log.d(TAG, "wrote " + bytesRead + " into byte output stream"); totalBufRead += bytesRead; buffer = new byte[bufSize]; timer.cancel(); timer = new Timer(); timer.schedule(new Timeout(this), Constants.FIRMWARE_UPGRADE_READ_TIMEOUT); } Log.d(TAG, "Download finished: " + (Integer.toString(totalBufRead)) + " bytes downloaded"); parser = new BuildPropParser(writer, context); timer.cancel(); } catch (SocketTimeoutException e) { String message = "Connection failure (Socket timeout) when retrieving update package size."; Log.e(TAG, message + e); CommonUtils.sendBroadcast(context, operation, Constants.Code.FAILURE, Constants.Status.CONNECTION_FAILED, message); CommonUtils.callAgentApp(context, Constants.Operation.FAILED_FIRMWARE_UPGRADE_NOTIFICATION, 0, null); } catch (IOException e) { String message = "Property list (build.prop) not found in the server."; Log.e(TAG, message + e); CommonUtils.sendBroadcast(context, operation, Constants.Code.FAILURE, Constants.Status.FILE_NOT_FOUND, message); CommonUtils.callAgentApp(context, Constants.Operation.FAILED_FIRMWARE_UPGRADE_NOTIFICATION, 0, null); } finally { if (reader != null) { try { reader.close(); } catch (IOException e) { Log.e(TAG, "Failed to close buffer reader." + e); } } if (writer != null) { try { writer.close(); } catch (IOException e) { Log.e(TAG, "Failed to close buffer writer." + e); } } if (parser != null) { if (stateChangeListener != null) { stateChangeListener.onStateOrProgress(OTAStateChangeListener.STATE_IN_CHECKED, OTAStateChangeListener.NO_ERROR, parser, DEFAULT_STATE_INFO_CODE); } } else { reportCheckingError(OTAStateChangeListener.ERROR_CANNOT_FIND_SERVER); } } return null; } }.executeOnExecutor(threadPoolExecutor); }
From source file:com.anp.bdmt.MainActivity.java
public void findLocation() { if (!mDialog.isShowing()) { mDialog.show();// ww w .jav a 2s . c o m } mLocationUtil.start(); TimerTask timerTask = new TimerTask() { public void run() { mHandler.post(new Runnable() { public void run() { try { sLatitude = mLocationUtil.getLastLocation().getLatitude(); sLongitude = mLocationUtil.getLastLocation().getLongitude(); new AddressJsonTask(mAddressText).execute(); String address; // address = mLocationUtil.getAddress(sLatitude, // sLongitude); mAddressText.setVisibility(View.VISIBLE); // mAddressText.setText(address); mGpsFlag = true; } catch (NullPointerException e) { Log.d("JAY", "gps exception"); e.printStackTrace(); mAddressText.setText("<- ? ? ."); mDialog.dismiss(); mGpsFlag = false; } } }); } }; if (mLocationUtil.isRunLocationUtil) { mLocationUtil.stop(); } Timer timer = new Timer(); timer.schedule(timerTask, 1000); }
From source file:org.wso2.iot.system.service.api.OTAServerManager.java
/** * Downloads the property list from remote site, and parse it to property list. * The caller can parse this list and get information. *//* www.j a v a 2 s . c o m*/ public void getTargetPackagePropertyList(final URL url) { final String operation = Preference.getBoolean(context, context.getResources().getString(R.string.firmware_status_check_in_progress)) ? Constants.Operation.GET_FIRMWARE_UPGRADE_PACKAGE_STATUS : Constants.Operation.UPGRADE_FIRMWARE; if (asyncTask != null) { asyncTask.cancel(true); } asyncTask = new AsyncTask<Void, Void, Void>() { protected Void doInBackground(Void... param) { InputStream reader = null; ByteArrayOutputStream writer = null; BuildPropParser parser = null; final int bufSize = 1024; // First, trying to download the property list file. the build.prop of target image. try { URLConnection urlConnection; /* Use the URL configuration to open a connection to the OTA server */ urlConnection = url.openConnection(); urlConnection.setConnectTimeout(Constants.FIRMWARE_UPGRADE_CONNECTIVITY_TIMEOUT); urlConnection.setReadTimeout(Constants.FIRMWARE_UPGRADE_READ_TIMEOUT); /* Since you get a URLConnection, use it to get the InputStream */ reader = urlConnection.getInputStream(); /* Now that the InputStream is open, get the content length */ final int contentLength = urlConnection.getContentLength(); byte[] buffer = new byte[bufSize]; if (contentLength != -1) { writer = new ByteArrayOutputStream(contentLength); } else { writer = new ByteArrayOutputStream(DEFAULT_STREAM_LENGTH); } int totalBufRead = 0; int bytesRead; Timer timer = new Timer(); Log.d(TAG, "Start download: " + url.toString() + " to buffer"); while ((bytesRead = reader.read(buffer)) > 0) { // Write current segment into byte output stream writer.write(buffer, 0, bytesRead); Log.d(TAG, "wrote " + bytesRead + " into byte output stream"); totalBufRead += bytesRead; buffer = new byte[bufSize]; timer.cancel(); timer = new Timer(); timer.schedule(new Timeout(this), Constants.FIRMWARE_UPGRADE_READ_TIMEOUT); } Log.d(TAG, "Download finished: " + (Integer.toString(totalBufRead)) + " bytes downloaded"); parser = new BuildPropParser(writer, context); timer.cancel(); } catch (SocketTimeoutException e) { String message = "Connection failure (Socket timeout) when retrieving update package size."; Log.e(TAG, message + e); CommonUtils.sendBroadcast(context, operation, Constants.Code.FAILURE, Constants.Status.CONNECTION_FAILED, message); CommonUtils.callAgentApp(context, Constants.Operation.FAILED_FIRMWARE_UPGRADE_NOTIFICATION, Preference.getInt(context, context.getResources().getString(R.string.operation_id)), message); } catch (IOException e) { String message = "Property list (build.prop) not found in the server."; Log.e(TAG, message + e); CommonUtils.sendBroadcast(context, operation, Constants.Code.FAILURE, Constants.Status.FILE_NOT_FOUND, message); CommonUtils.callAgentApp(context, Constants.Operation.FAILED_FIRMWARE_UPGRADE_NOTIFICATION, Preference.getInt(context, context.getResources().getString(R.string.operation_id)), message); } finally { if (reader != null) { try { reader.close(); } catch (IOException e) { Log.e(TAG, "Failed to close buffer reader." + e); } } if (writer != null) { try { writer.close(); } catch (IOException e) { Log.e(TAG, "Failed to close buffer writer." + e); } } if (parser != null) { if (stateChangeListener != null) { stateChangeListener.onStateOrProgress(OTAStateChangeListener.STATE_IN_CHECKED, OTAStateChangeListener.NO_ERROR, parser, DEFAULT_STATE_INFO_CODE); } } else { reportCheckingError(OTAStateChangeListener.ERROR_CANNOT_FIND_SERVER); } } return null; } }.executeOnExecutor(threadPoolExecutor); }
From source file:org.opencron.agent.AgentProcessor.java
@Override public Response execute(final Request request) throws TException { if (!this.password.equalsIgnoreCase(request.getPassword())) { return errorPasswordResponse(request); }//from ww w . j av a2s .c o m String command = request.getParams().get("command") + EXITCODE_SCRIPT; String pid = request.getParams().get("pid"); //?? Long timeout = CommonUtils.toLong(request.getParams().get("timeout"), 0L); boolean timeoutFlag = timeout > 0; logger.info("[opencron]:execute:{},pid:{}", command, pid); File shellFile = CommandUtils.createShellFile(command, pid); Integer exitValue; ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); final Response response = Response.response(request); final ExecuteWatchdog watchdog = new ExecuteWatchdog(Integer.MAX_VALUE); final Timer timer = new Timer(); DefaultExecuteResultHandler resultHandler = new DefaultExecuteResultHandler(); try { CommandLine commandLine = CommandLine.parse("/bin/bash +x " + shellFile.getAbsolutePath()); final DefaultExecutor executor = new DefaultExecutor(); ExecuteStreamHandler stream = new PumpStreamHandler(outputStream, outputStream); executor.setStreamHandler(stream); response.setStartTime(new Date().getTime()); //?0,shell executor.setExitValue(0); if (timeoutFlag) { //... executor.setWatchdog(watchdog); // timer.schedule(new TimerTask() { @Override public void run() { //,kill... if (watchdog.isWatching()) { /** * watchdogdestroyProcesskill... * watchdog.destroyProcess(); */ timer.cancel(); watchdog.stop(); //call kill... request.setAction(Action.KILL); try { kill(request); response.setExitCode(Opencron.StatusCode.TIME_OUT.getValue()); } catch (TException e) { e.printStackTrace(); } } } }, timeout * 60 * 1000); // resultHandler = new DefaultExecuteResultHandler() { @Override public void onProcessComplete(int exitValue) { super.onProcessComplete(exitValue); timer.cancel(); } @Override public void onProcessFailed(ExecuteException e) { super.onProcessFailed(e); timer.cancel(); } }; } executor.execute(commandLine, resultHandler); resultHandler.waitFor(); } catch (Exception e) { if (e instanceof ExecuteException) { exitValue = ((ExecuteException) e).getExitValue(); } else { exitValue = Opencron.StatusCode.ERROR_EXEC.getValue(); } if (Opencron.StatusCode.KILL.getValue().equals(exitValue)) { if (timeoutFlag) { timer.cancel(); watchdog.stop(); } logger.info("[opencron]:job has be killed!at pid :{}", request.getParams().get("pid")); } else { logger.info("[opencron]:job execute error:{}", e.getCause().getMessage()); } } finally { exitValue = resultHandler.getExitValue(); if (CommonUtils.notEmpty(outputStream.toByteArray())) { try { outputStream.flush(); String text = outputStream.toString(); if (notEmpty(text)) { try { text = text.replaceAll(String.format(REPLACE_REX, shellFile.getAbsolutePath()), ""); response.setMessage(text.substring(0, text.lastIndexOf(EXITCODE_KEY))); exitValue = Integer.parseInt(text .substring(text.lastIndexOf(EXITCODE_KEY) + EXITCODE_KEY.length() + 1).trim()); } catch (IndexOutOfBoundsException e) { response.setMessage(text); } } outputStream.close(); } catch (Exception e) { logger.error("[opencron]:error:{}", e); } } if (Opencron.StatusCode.TIME_OUT.getValue() == response.getExitCode()) { response.setSuccess(false).end(); } else { response.setExitCode(exitValue) .setSuccess(response.getExitCode() == Opencron.StatusCode.SUCCESS_EXIT.getValue()).end(); } if (shellFile != null) { shellFile.delete();// } } logger.info("[opencron]:execute result:{}", response.toString()); watchdog.stop(); return response; }
From source file:flex.android.magiccube.activity.ActivityBattleMode.java
private void SetupGame() throws JSONException { if (MagiccubePreference.GetPreference(MagiccubePreference.ServerOrClient, this) == 1) { JSONObject jobj = new JSONObject(); // 1. setup the messup String MessUpCmd1 = ""; String MessUpCmd2 = ""; switch (MagiccubePreference.GetPreference(MagiccubePreference.Difficulty, this)) { case 0:/*from w w w . j ava 2s . c o m*/ nMessUp = 4; break; case 50: nMessUp = 10; break; case 100: nMessUp = 30; break; } if (MagiccubePreference.GetPreference(MagiccubePreference.IsSameMessup, this) == 1) { MessUpCmd1 = glView.MessUp(nMessUp); glView2.MessUp(MessUpCmd1); jobj.put(BluetoothSignal.MessUpCmd2, MessUpCmd1); jobj.put(BluetoothSignal.MessUpCmd1, MessUpCmd1); } else { MessUpCmd1 = glView.MessUp(nMessUp); MessUpCmd2 = glView2.MessUp(nMessUp); jobj.put(BluetoothSignal.MessUpCmd2, MessUpCmd1); jobj.put(BluetoothSignal.MessUpCmd1, MessUpCmd2); } // 2. setup the obervetime // Log.e("2", "2"); TotalObTime = MagiccubePreference.GetPreference(MagiccubePreference.ObserveTime, this); // Toast.makeText(this, TotalObTime+"", Toast.LENGTH_SHORT).show(); jobj.put(BluetoothSignal.ObserveTime, TotalObTime + ""); // 3. end up // Log.e("3", "3"); jobj.put(BluetoothSignal.EndSetUp, "end"); this.sendMessage(jobj.toString()); } else if (MagiccubePreference.GetPreference(MagiccubePreference.ServerOrClient, this) == 0) { long waittime = 6000; Timer t = new Timer(); t.schedule(new TimerTask() { @Override public void run() { // TODO Auto-generated method stub if (!HeartBeating) { mHandler.sendEmptyMessage(NOT_HEART_BEATING); } } }, waittime); } }
From source file:edu.caltechUcla.sselCassel.projects.jMarkets.server.control.DispatchServ.java
/** Terminate the given session. Delete the clients involved in the session from the roster * of the updateServ, shut down all remaining JTimers associated with the session, and * tell the controlServ to drop all information regarding the session. Return true if * termination succeeds. Wait the given number of seconds before terminating. This is needed * because if we terminate immediately after a session ends, the clients may not have time * to get the END_PERIOD_UPDATES */ private synchronized boolean terminateSession(int sessionId, int waitTime) { try {/* w w w. j a v a2 s . co m*/ Timer timer = new Timer(); final int sid = sessionId; final TradeEngine tradeServ = activeEngines.get(sid); TimerTask task = new TimerTask() { public void run() { int[] clients = controlServ.getSessionClients(sid); jTimer.terminateSession(sid); updateServ.deleteClients(clients); controlServ.terminateSession(sid); monitorServ.terminateSession(sid); tradeServ.terminateSession(sid); log.info("Session " + sid + " fully terminated, all remaining clients will be deactivated"); } }; timer.schedule(task, waitTime); return true; } catch (Exception e) { log.error("Failed to terminate session " + sessionId, e); } return false; }