@ManagedOperation(description="Opens the barrier. No-op if already open") public void openBarrier() { if(!barrier_closed.compareAndSet(true, false)) return; // barrier was already open cancelBarrierOpener(); // cancels if running synchronized(mcast_queue) { flushQueue(mcast_queue); } synchronized(ucast_queue) { flushQueue(ucast_queue); } }
public Object up(Event evt) { switch(evt.getType()) { case Event.CLOSE_BARRIER: try { closeBarrier(); return null; } catch(TimeoutException e) { throw new RuntimeException(e); } case Event.OPEN_BARRIER: openBarrier(); return null; } return up_prot.up(evt); }
long time=System.currentTimeMillis() - start; throw new TimeoutException(local_addr + ": failed flushing pending threads in " + time + " ms; threads:\n" + printInFlightThreads()); scheduleBarrierOpener();
public void destroy() { super.destroy(); openBarrier(); }
private void openBarrier() { lock.lock(); try { if(!barrier_closed.compareAndSet(true, false)) return; // barrier was already open barrier_opened.signalAll(); } finally { lock.unlock(); } if(log.isTraceEnabled()) log.trace("barrier was opened"); cancelBarrierOpener(); // cancels if running }
public Object up(Message msg) { // https://issues.jboss.org/browse/JGRP-1341: let unicast messages pass if(msg.isFlagSet(Message.Flag.SKIP_BARRIER) || msg.getDest() != null && ((msg.isFlagSet(Message.Flag.OOB) && msg.isFlagSet(Message.Flag.INTERNAL)) || holes.contains(msg.getSrc()))) return up_prot.up(msg); if(barrier_closed.get()) { final Map<Address,Message> map=msg.getDest() == null? mcast_queue : ucast_queue; map.put(msg.getSrc(), msg); return null; // queue and drop the message } Thread current_thread=Thread.currentThread(); in_flight_threads.put(current_thread, NULL); try { return up_prot.up(msg); } finally { unblock(current_thread); } }
private void closeBarrier() { if(!barrier_closed.compareAndSet(false, true)) return; // barrier was already closed lock.lock(); try { // wait until all pending (= in-progress) msgs have returned in_flight_threads.remove(Thread.currentThread()); while(!in_flight_threads.isEmpty()) { try { no_msgs_pending.await(); } catch(InterruptedException e) { } } } finally { lock.unlock(); } if(log.isTraceEnabled()) log.trace("barrier was closed"); if(max_close_time > 0) scheduleBarrierOpener(); }
public void init() throws Exception { super.init(); transport=getTransport(); timer=transport.getTimer(); }
@ManagedAttribute public int getInFlightThreadsCount() { return getNumberOfInFlightThreads(); }
new FD_ALL(), new VERIFY_SUSPECT(), new BARRIER(), new NAKACK2(), new UNICAST3(),
public void stop() { super.stop(); openBarrier(); }
public void up(MessageBatch batch) { // let unicast message batches pass if(batch.dest() != null && (batch.mode() == MessageBatch.Mode.OOB && batch.mode() == MessageBatch.Mode.INTERNAL) || holes.contains(batch.sender())) { up_prot.up(batch); return; } if(barrier_closed.get()) { final Map<Address,Message> map=batch.dest() == null? mcast_queue : ucast_queue; map.put(batch.sender(), batch.last().putHeader(transport.getId(),new TpHeader(batch.clusterName()))); return; // queue the last message of the batch and drop the batch } Thread current_thread=Thread.currentThread(); in_flight_threads.put(current_thread, NULL); try { up_prot.up(batch); } finally { unblock(current_thread); } }
public void init() throws Exception { super.init(); transport=getTransport(); timer=transport.getTimer(); }
@ManagedAttribute public int getInFlightThreadsCount() { return getNumberOfInFlightThreads(); }
new FD_ALL(), new VERIFY_SUSPECT(), new BARRIER(), new NAKACK2(), new UNICAST3(),
public Object down(Event evt) { switch(evt.getType()) { case Event.CLOSE_BARRIER: try { closeBarrier(); } catch(TimeoutException e) { throw new RuntimeException(e); } return null; case Event.OPEN_BARRIER: openBarrier(); return null; case Event.SET_LOCAL_ADDRESS: local_addr=evt.getArg(); break; case Event.PUNCH_HOLE: Address mbr=evt.getArg(); holes.add(mbr); return null; case Event.CLOSE_HOLE: mbr=evt.getArg(); holes.remove(mbr); return null; } return down_prot.down(evt); }
public void destroy() { super.destroy(); openBarrier(); }
@ManagedOperation(description="Opens the barrier. No-op if already open") public void openBarrier() { if(!barrier_closed.compareAndSet(true, false)) return; // barrier was already open cancelBarrierOpener(); // cancels if running synchronized(mcast_queue) { flushQueue(mcast_queue); } synchronized(ucast_queue) { flushQueue(ucast_queue); } }
long time=System.currentTimeMillis() - start; throw new TimeoutException(local_addr + ": failed flushing pending threads in " + time + " ms; threads:\n" + printInFlightThreads()); scheduleBarrierOpener();
public Object up(Message msg) { // https://issues.jboss.org/browse/JGRP-1341: let unicast messages pass if(msg.isFlagSet(Message.Flag.SKIP_BARRIER) || msg.getDest() != null && ((msg.isFlagSet(Message.Flag.OOB) && msg.isFlagSet(Message.Flag.INTERNAL)) || holes.contains(msg.getSrc()))) return up_prot.up(msg); if(barrier_closed.get()) { final Map<Address,Message> map=msg.getDest() == null? mcast_queue : ucast_queue; map.put(msg.getSrc(), msg); return null; // queue and drop the message } Thread current_thread=Thread.currentThread(); in_flight_threads.put(current_thread, NULL); try { return up_prot.up(msg); } finally { unblock(current_thread); } }