private synchronized Set<PageSubscriptionCounter> getOrCreatePendingCounters() { if (pendingCounters == null) { pendingCounters = new ConcurrentHashSet<PageSubscriptionCounter>(); } return pendingCounters; } }
private CountDownLatch newLatch(int countDown) { if (state == JournalState.STOPPED) { throw new RuntimeException("Server is not started"); } CountDownLatch latch = new CountDownLatch(countDown); latches.add(latch); return latch; }
@Override public void afterCommit(Transaction tx) { pendingDeletes.remove(uniqueName); }
ConcurrentHashSet<SimpleString> set = new ConcurrentHashSet<SimpleString>(); ConcurrentHashSet<SimpleString> act = cache.putIfAbsent(user + "." + checkType.name(), set); if (act != null) set.add(address);
private boolean checkCached(final SimpleString dest, final String user, final CheckType checkType) { long now = System.currentTimeMillis(); boolean granted = false; if (now - lastCheck > invalidationInterval) { invalidateCache(); lastCheck = now; } else { ConcurrentHashSet<SimpleString> act = cache.get(user + "." + checkType.name()); if (act != null) { granted = act.contains(dest); } } return granted; }
ConcurrentHashSet<SimpleString> set = new ConcurrentHashSet<SimpleString>(); ConcurrentHashSet<SimpleString> act = cache.putIfAbsent(user + "." + checkType.name(), set); if (act != null) set.add(address);
private boolean checkCached(final SimpleString dest, final String user, final CheckType checkType) { long now = System.currentTimeMillis(); boolean granted = false; if (now - lastCheck > invalidationInterval) { invalidateCache(); lastCheck = now; } else { ConcurrentHashSet<SimpleString> act = cache.get(user + "." + checkType.name()); if (act != null) { granted = act.contains(dest); } } return granted; }
private ConcurrentHashSet<CountDownLatch> latches = new ConcurrentHashSet<CountDownLatch>();
private CountDownLatch newLatch(int countDown) { if (state == JournalState.STOPPED) { throw new RuntimeException("Server is not started"); } CountDownLatch latch = new CountDownLatch(countDown); latches.add(latch); return latch; }
@Override public void afterRollback(Transaction tx) { nameMap.put(uniqueName, binding); pendingDeletes.remove(uniqueName); }
public boolean addBinding(final Binding binding) throws Exception { if (nameMap.putIfAbsent(binding.getUniqueName(), binding) != null || pendingDeletes.contains(binding.getUniqueName())) { throw HornetQMessageBundle.BUNDLE.bindingAlreadyExists(binding); } if (HornetQServerLogger.LOGGER.isTraceEnabled()) { HornetQServerLogger.LOGGER.trace("Adding binding " + binding + " with address = " + binding.getUniqueName(), new Exception("trace")); } return addMappingInternal(binding.getAddress(), binding); }
private ConcurrentHashSet<CountDownLatch> latches = new ConcurrentHashSet<CountDownLatch>();
public Binding removeBinding(final SimpleString uniqueName, Transaction tx) throws Exception { final Binding binding = nameMap.remove(uniqueName); if (binding == null) { return null; } if (tx != null) { pendingDeletes.add(uniqueName); tx.addOperation(new TransactionOperationAbstract() { @Override public void afterCommit(Transaction tx) { pendingDeletes.remove(uniqueName); } @Override public void afterRollback(Transaction tx) { nameMap.put(uniqueName, binding); pendingDeletes.remove(uniqueName); } }); } removeBindingInternal(binding.getAddress(), uniqueName); return binding; }
private void awaitLatch(CountDownLatch latch, int timeout) throws InterruptedException { try { if (timeout < 0) { latch.await(); } else { latch.await(timeout, TimeUnit.SECONDS); } // in case of an interrupted server, we need to make sure we don't proceed on anything if (state == JournalState.STOPPED) { throw new RuntimeException("Server is not started"); } } finally { latches.remove(latch); } }
private final Set<ScheduledFuture<?>> futures = new ConcurrentHashSet<ScheduledFuture<?>>();
private void awaitLatch(CountDownLatch latch, int timeout) throws InterruptedException { try { if (timeout < 0) { latch.await(); } else { latch.await(timeout, TimeUnit.SECONDS); } // in case of an interrupted server, we need to make sure we don't proceed on anything if (state == JournalState.STOPPED) { throw new RuntimeException("Server is not started"); } } finally { latches.remove(latch); } }
private final Set<ScheduledFuture<?>> futures = new ConcurrentHashSet<ScheduledFuture<?>>();
private final Set<SessionFailureListener> listeners = new ConcurrentHashSet<SessionFailureListener>(); private final Set<FailoverEventListener> failoverListeners = new ConcurrentHashSet<FailoverEventListener>();