Example usage for org.apache.commons.collections15 BufferUtils synchronizedBuffer

List of usage examples for org.apache.commons.collections15 BufferUtils synchronizedBuffer

Introduction

In this page you can find the example usage for org.apache.commons.collections15 BufferUtils synchronizedBuffer.

Prototype

public static <E> Buffer<E> synchronizedBuffer(Buffer<E> buffer) 

Source Link

Document

Returns a synchronized buffer backed by the given buffer.

Usage

From source file:edu.cuny.cat.task.DispatchingTaskQueue.java

public DispatchingTaskQueue() {
    tasks = BufferUtils.synchronizedBuffer(new UnboundedFifoBuffer<DispatchingTask>());
}

From source file:edu.cuny.util.ResourcePool.java

public ResourcePool(final ResourceFactory<R> factory, final int initial_capacity) {
    this.factory = factory;
    this.buffer = BufferUtils.synchronizedBuffer(new UnboundedFifoBuffer<R>());

    for (int i = 0; i < initial_capacity; i++) {
        addResource();//from w w  w .jav  a  2s .  c o m
    }
}

From source file:edu.cuny.cat.comm.QueueBasedInfrastructureImpl.java

public QueueBasedInfrastructureImpl() {
    waitingClients = BufferUtils.synchronizedBuffer(new UnboundedFifoBuffer<QueueBasedCatpClientConnector>());
    connections = Collections.synchronizedMap(new HashMap<Object, QueueBasedCatpConnection>());
    idAllocator = new IdAllocator();
}

From source file:edu.cuny.cat.comm.CallBasedInfrastructureImpl.java

public CallBasedInfrastructureImpl() {
    waitingClients = BufferUtils.synchronizedBuffer(new UnboundedFifoBuffer<CallBasedCatpClientConnector>());
    connections = Collections.synchronizedMap(new HashMap<Object, CallBasedCatpConnection>());
    idAllocator = new IdAllocator();
}

From source file:edu.cuny.cat.comm.QueueBasedCatpConnection.java

public synchronized void open() throws ConnectionException {
    messages = BufferUtils.synchronizedBuffer(new UnboundedFifoBuffer<CatpMessage>());
    notifyAll();/*from   www.j  a  v  a2 s  .c  o  m*/
}

From source file:edu.cuny.cat.server.ConnectionAdaptor.java

public ConnectionAdaptor(final ConnectionManager manager, final Connection<CatpMessage> conn) {

    eventEngine = Galaxy.getInstance().getDefaultTyped(EventEngine.class);

    this.manager = manager;

    controller = GameController.getInstance();

    clock = controller.getClock();// www.  ja  v a 2s  .co m
    shoutValidator = controller.getShoutValidator();
    transactionValidator = controller.getTransactionValidator();
    chargeValidator = controller.getChargeValidator();
    registry = controller.getRegistry();
    timeController = controller.getTimeController();

    proactiveSessions = BufferUtils.synchronizedBuffer(new UnboundedFifoBuffer<CatpProactiveSession>());
    pendingRequestSessions = Collections.synchronizedMap(new HashMap<String, ShoutFromTraderSession>());

    connection = ListenableConnection.makeReactiveConnection(conn);

    setExpectedReactiveSessions(
            new CatpReactiveSession[] { new CheckInSession(), new OracleSession("BeforeCheckIn") });

    openConnection();

    setState(ClientState.READY, ClientState.getCodeDesc(ClientState.READY) + " for checking in");
}

From source file:edu.cuny.cat.GameClient.java

/*****************************************************************************
 * //from   w  ww .  j  a  v  a  2s  .co  m
 * constructors and setup
 * 
 ****************************************************************************/

public GameClient() {
    eventEngine = Galaxy.getInstance().getTyped(Game.P_CAT, EventEngine.class);
    prng = Galaxy.getInstance().getTyped(Game.P_CAT, GlobalPRNG.class);
    infrast = Galaxy.getInstance().getTyped(Game.P_CAT, CatpInfrastructure.class);

    clientConnector = infrast.createClientConnector();

    dispatcher = new SynchronousDispatcher();
    eventListeners = new LinkedList<AuctionEventListener>();

    proactiveSessions = BufferUtils.synchronizedBuffer(new UnboundedFifoBuffer<CatpProactiveSession>());

    registry = createRegistry();

    addAuctionEventListener(this);
    addAuctionEventListener(registry);
}