Example usage for org.apache.thrift.server TThreadPoolServer.Args requestTimeoutUnit

List of usage examples for org.apache.thrift.server TThreadPoolServer.Args requestTimeoutUnit

Introduction

In this page you can find the example usage for org.apache.thrift.server TThreadPoolServer.Args requestTimeoutUnit.

Prototype

TimeUnit requestTimeoutUnit

To view the source code for org.apache.thrift.server TThreadPoolServer.Args requestTimeoutUnit.

Click Source Link

Usage

From source file:jessy.shipgirlcombatsystem.net.Server.java

public Server(int port) throws IOException, TTransportException {
    this.socket = new ServerSocket(port);
    panel = new MapPanel();

    Ship redShip = new Ship(gameState.getNewUniqueID(), new Player("A", Color.pink));
    redShip.addEquipment(new ShipWeaponSystem("Big Gun", redShip));
    redShip.addEquipment(new ShipWeaponSystem("Small Gun", redShip));
    gameState.add(redShip, new Hex(4, 4));
    Ship blueShip = new Ship(gameState.getNewUniqueID(), new Player("D", new Color(50, 50, 255)));
    blueShip.addEquipment(new ShipWeaponSystem("Big Gun", blueShip));
    blueShip.addEquipment(new ShipWeaponSystem("Small Gun", blueShip));
    blueShip.setFacing(Direction.SOUTH);
    gameState.add(blueShip, new Hex(-4, -4));

    //gameState.add(new Ship(gameState.getNewUniqueID(), new Player("B", new Color(50,255,50))), new Hex(2,-2));
    //gameState.add(new Ship(gameState.getNewUniqueID(), new Player("C", Color.YELLOW)), new Hex(-2,2));

    panel.applyNewTurn(gameState, currentPhase);

    TServerSocket tsock = new TServerSocket(socket);
    TThreadPoolServer.Args args = new TThreadPoolServer.Args(tsock);
    args.requestTimeout(2);//from www  . j  a v a2  s  .  c  o  m
    args.requestTimeoutUnit(TimeUnit.HOURS);
    args.processor(new ShipGirlCombatSystemServer.Processor<>(processor));
    server = new TThreadPoolServer(args);
    server.serve();
}