private void checkNotStarted() { if (started) { throw new IllegalThreadStateException("Thread already started"); } }
public int exitValue() { synchronized (exitValueMutex) { if (exitValue == null) { throw new IllegalThreadStateException("Process has not yet terminated: " + pid); } return exitValue; } }
private void checkQueueLength() { if (connectionExecutor.getQueue().size() > queuewarninglimit) { logger.warn(new IllegalThreadStateException("connectionordered channel handler `queue size: " + connectionExecutor.getQueue().size() + " exceed the warning limit number :" + queuewarninglimit)); } } }
private void checkQueueLength() { if (connectionExecutor.getQueue().size() > queuewarninglimit) { logger.warn(new IllegalThreadStateException("connectionordered channel handler `queue size: " + connectionExecutor.getQueue().size() + " exceed the warning limit number :" + queuewarninglimit)); } } }
/** * Adds a {@code ThreadGroup} to this thread group. * * @param g ThreadGroup to add * @throws IllegalThreadStateException if this group has been destroyed already */ private void add(ThreadGroup g) throws IllegalThreadStateException { synchronized (groups) { if (isDestroyed) { throw new IllegalThreadStateException(); } groups.add(g); } }
/** * Called by the Thread constructor. */ final void addThread(Thread thread) throws IllegalThreadStateException { synchronized (threadRefs) { if (isDestroyed) { throw new IllegalThreadStateException(); } threadRefs.add(new WeakReference<Thread>(thread)); } }
protected RollbackStateLocal getRollbackStateLocal() { RollbackStateLocal rollbackStateLocal = RollbackStateLocal.getRollbackStateLocal(); if (rollbackStateLocal == null) { throw new IllegalThreadStateException("Unable to perform ActivityStateManager operation, as the RollbackStateLocal instance is not set on the current thread! ActivityStateManager methods may not be called outside the scope of workflow execution."); } return rollbackStateLocal; }
public CallStackItem pop() { try { CallStackItem result = callStack[--callStackTop]; result.clear(); // clear for GC return result; } catch (ArrayIndexOutOfBoundsException e) { throw new IllegalThreadStateException(); } }
@Override public RAMDataAccess create(long bytes) { if (segments.length > 0) throw new IllegalThreadStateException("already created"); setSegmentSize(segmentSizeInBytes); ensureCapacity(Math.max(10 * 4, bytes)); return this; }
@Override public RAMIntDataAccess create(long bytes) { if (segments.length > 0) throw new IllegalThreadStateException("already created"); setSegmentSize(segmentSizeInBytes); ensureCapacity(Math.max(10 * 4, bytes)); return this; }
@Override public MMapDataAccess create(long bytes) { if (!segments.isEmpty()) { throw new IllegalThreadStateException("already created"); } initRandomAccessFile(); bytes = Math.max(10 * 4, bytes); setSegmentSize(segmentSizeInBytes); ensureCapacity(bytes); return this; }
synchronized (groups) { if (isDestroyed) { throw new IllegalThreadStateException( "Thread group was already destroyed: " + (this.name != null ? this.name : "n/a")); throw new IllegalThreadStateException( "Thread group still contains threads: " + (this.name != null ? this.name : "n/a"));
private void wait(final ConnectSubscriber subscriber) { final ConnectListener connectListener = new ConnectListener(subscriber); //noinspection SynchronizationOnLocalVariableOrMethodParameter synchronized (connectListener) { FileDownloader.getImpl().bindService(connectListener); if (!connectListener.isFinished()) { if (Thread.currentThread() == Looper.getMainLooper().getThread()) { throw new IllegalThreadStateException("Sorry, FileDownloader can not block the " + "main thread, because the system is also callbacks " + "ServiceConnection#onServiceConnected method in the main thread."); } try { connectListener.wait(200 * 1000); } catch (InterruptedException e) { e.printStackTrace(); } } } }
throw new IllegalThreadStateException("Group already destroyed");
@Test public void shouldReturnTrueWhenAProcessIsRunning(){ Process process = getMockedProcess(mock(OutputStream.class)); when(process.exitValue()).thenThrow(new IllegalThreadStateException()); ProcessWrapper processWrapper = new ProcessWrapper(process, "", "", inMemoryConsumer(), "utf-8", null); assertThat(processWrapper.isRunning(), is(true)); }
if (!waitingThread.interruptedByConnectionPool) { LOG.debug("Interrupted while waiting for connection", e); throw new IllegalThreadStateException( "Interrupted while waiting in MultiThreadedHttpConnectionManager");
(rs == SHUTDOWN && firstTask == null)) { if (t.isAlive()) // precheck that t is startable throw new IllegalThreadStateException(); workers.add(w); int s = workers.size();
public synchronized void start() { /* * A zero status value corresponds to state "NEW". */ if (threadStatus != 0) throw new IllegalThreadStateException(); group.add(this); start0(); if (stopBeforeStart) { stop0(throwableFromStop); } }
//... if (threadStatus != 0) throw new IllegalThreadStateException(); // ... start0(); //...
@Override public int exitValue() { if(!processTerminationMonitor.isCancelled()) { throw new IllegalThreadStateException(); } return 0; }