/** * Sub classes (tests basically) can use this to override disabling spinning */ protected void stopSpin() { if (spinning) { try { // We acquire the spinLimiter semaphore - this prevents the timer flush thread unnecessarily spinning // when the buffer is inactive spinLimiter.acquire(); } catch (InterruptedException e) { throw new HornetQInterruptedException(e); } spinning = false; } }
private void handleConnectionFailure(final Object connectionID, final HornetQException me) { try { failoverOrReconnect(connectionID, me); } catch (HornetQInterruptedException e1) { // this is just a debug, since an interrupt is an expected event (in case of a shutdown) HornetQClientLogger.LOGGER.debug(e1.getMessage(), e1); } }
/** * Sub classes (tests basically) can use this to override disabling spinning */ protected void stopSpin() { if (spinning) { try { // We acquire the spinLimiter semaphore - this prevents the timer flush thread unnecessarily spinning // when the buffer is inactive spinLimiter.acquire(); } catch (InterruptedException e) { throw new HornetQInterruptedException(e); } spinning = false; } }
public boolean waitForBroadcast(final long timeout) { synchronized (waitLock) { long start = System.currentTimeMillis(); long toWait = timeout; while (started && !received && (toWait > 0 || timeout == 0)) { try { waitLock.wait(toWait); } catch (InterruptedException e) { throw new HornetQInterruptedException(e); } if (timeout != 0) { long now = System.currentTimeMillis(); toWait -= now - start; start = now; } } boolean ret = received; received = false; return ret; } }
public void close(final boolean criticalError) { closed = true; latch.countDown(); if (!criticalError) { try { join(); } catch (InterruptedException e) { throw new HornetQInterruptedException(e); } } }
throw new HornetQInterruptedException(e); throw new HornetQInterruptedException(e);
private void resetIfSlowConsumer() { if (clientWindowSize == 0) { sendCredits(0); // If resetting a slow consumer, we need to wait the execution final CountDownLatch latch = new CountDownLatch(1); flowControlExecutor.execute(new Runnable() { public void run() { latch.countDown(); } }); try { latch.await(10, TimeUnit.SECONDS); } catch (InterruptedException e) { throw new HornetQInterruptedException(e); } } }
public synchronized void start() { if (started) { return; } // Need to start with the spin limiter acquired try { spinLimiter.acquire(); } catch (InterruptedException e) { throw new HornetQInterruptedException(e); } timerRunnable = new CheckTimer(); timerThread = new Thread(timerRunnable, "hornetq-buffer-timeout"); timerThread.start(); if (logRates) { logRatesTimerTask = new LogRatesTimerTask(); logRatesTimer.scheduleAtFixedRate(logRatesTimerTask, 2000, 2000); } started = true; }
public synchronized void start() { if (started) { return; } // Need to start with the spin limiter acquired try { spinLimiter.acquire(); } catch (InterruptedException e) { throw new HornetQInterruptedException(e); } timerRunnable = new CheckTimer(); timerThread = new Thread(timerRunnable, "hornetq-buffer-timeout"); timerThread.start(); if (logRates) { logRatesTimerTask = new LogRatesTimerTask(); logRatesTimer.scheduleAtFixedRate(logRatesTimerTask, 2000, 2000); } started = true; }
public void stop() { if (!started) { return; } flush(); bufferObserver = null; timerRunnable.close(); spinLimiter.release(); if (logRates) { logRatesTimerTask.cancel(); } while (timerThread.isAlive()) { try { timerThread.join(); } catch (InterruptedException e) { throw new HornetQInterruptedException(e); } } started = false; }
public void stop() { if (!started) { return; } flush(); bufferObserver = null; timerRunnable.close(); spinLimiter.release(); if (logRates) { logRatesTimerTask.cancel(); } while (timerThread.isAlive()) { try { timerThread.join(); } catch (InterruptedException e) { throw new HornetQInterruptedException(e); } } started = false; }
@Override public void stop() { buffersControl.stop(); if (pollerExecutor != null) { pollerExecutor.shutdown(); try { if (!pollerExecutor.awaitTermination(AbstractSequentialFileFactory.EXECUTOR_TIMEOUT, TimeUnit.SECONDS)) { HornetQJournalLogger.LOGGER.timeoutOnPollerShutdown(new Exception("trace")); } } catch (InterruptedException e) { throw new HornetQInterruptedException(e); } } super.stop(); }
@Override public void stop() { buffersControl.stop(); if (pollerExecutor != null) { pollerExecutor.shutdown(); try { if (!pollerExecutor.awaitTermination(AbstractSequentialFileFactory.EXECUTOR_TIMEOUT, TimeUnit.SECONDS)) { HornetQJournalLogger.LOGGER.timeoutOnPollerShutdown(new Exception("trace")); } } catch (InterruptedException e) { throw new HornetQInterruptedException(e); } } super.stop(); }
public void stop() { if (timedBuffer != null) { timedBuffer.stop(); } if (isSupportsCallbacks() && writeExecutor != null) { writeExecutor.shutdown(); try { if (!writeExecutor.awaitTermination(AbstractSequentialFileFactory.EXECUTOR_TIMEOUT, TimeUnit.SECONDS)) { HornetQJournalLogger.LOGGER.timeoutOnWriterShutdown(new Exception("trace")); } } catch (InterruptedException e) { throw new HornetQInterruptedException(e); } } }
public void stop() { if (timedBuffer != null) { timedBuffer.stop(); } if (isSupportsCallbacks() && writeExecutor != null) { writeExecutor.shutdown(); try { if (!writeExecutor.awaitTermination(AbstractSequentialFileFactory.EXECUTOR_TIMEOUT, TimeUnit.SECONDS)) { HornetQJournalLogger.LOGGER.timeoutOnWriterShutdown(new Exception("trace")); } } catch (InterruptedException e) { throw new HornetQInterruptedException(e); } } }
private void sendInitialLargeMessageHeader(MessageInternal msgI, ClientProducerCredits credits) throws HornetQException { SessionSendLargeMessage initialChunk = new SessionSendLargeMessage(msgI); channel.send(initialChunk); try { credits.acquireCredits(msgI.getHeadersAndPropertiesEncodeSize()); } catch (InterruptedException e) { throw new HornetQInterruptedException(e); } }