NetQProxy.java :  » Game » inequity » network » Java Open Source

Java Open Source » Game » inequity 
inequity » network » NetQProxy.java
package network;

import java.util.concurrent.PriorityBlockingQueue;
import packets.CommandRequest;

/**
 * Network proxy that holds connection objects to client
 * @author Joel Garboden
 */
public class NetQProxy
{
  public String playerName;
  private boolean active;
  private Thread in;
  private Thread out;
  public PriorityBlockingQueue<CommandRequest> queue;

  /**
   * Constructor
   * @param in either Net2QRunnable or Q2NetRunnable depending on network side
   * @param out opposite of in's object type
   * @param outQ outgoing packet queue
   */
  public NetQProxy(Thread in, Thread out, PriorityBlockingQueue<CommandRequest> outQ)
  {
    active = true;
    this.in = in;
    this.out = out;
    queue = outQ;
  }

  /**
   * Mutator
   * @param active activity state
   */
  public void setActive(boolean active)
  {
    this.active = active;
  }

  /**
   * Accessor
   * @return activity state
   */
  public boolean isActive()
  {
    return active;
  }

  public void setPlayerName(String playerName)
  {
    this.playerName = playerName;
  }

  public String getPlayerName()
  {
    return playerName;
  }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.