Exemplo n.º 1
0
 @Override
 public boolean contains(final Tickable T, final int tickID) {
   if (tickID >= 0) return tickers.contains(new StdTickClient(T, 0, tickID));
   return tickers
           .subSet(
               new StdTickClient(T, 0, -1), true, new StdTickClient(T, 0, Integer.MAX_VALUE), true)
           .size()
       > 0;
 }
Exemplo n.º 2
0
 @Override
 public Iterator<TickClient> getTickSet(final Tickable T, final int tickID) {
   final LinkedList<TickClient> subSet = new LinkedList<TickClient>();
   if (tickID < 0)
     subSet.addAll(
         tickers.subSet(
             new StdTickClient(T, 0, 0), true, new StdTickClient(T, 0, Integer.MAX_VALUE), true));
   else
     subSet.addAll(
         tickers.subSet(
             new StdTickClient(T, 0, tickID), true, new StdTickClient(T, 0, tickID), true));
   return subSet.iterator();
 }
Exemplo n.º 3
0
  @Override
  public void run() {

    nextTickTime = System.currentTimeMillis() + tickTime;
    // final String oldThreadName=Thread.currentThread().getName();
    try {
      currentThread = Thread.currentThread();
      lastStart = System.currentTimeMillis();
      lastClient = null;
      final boolean allSuspended = CMLib.threads().isAllSuspended();
      if ((CMProps.getBoolVar(CMProps.Bool.MUDSTARTED)) && (!allSuspended)) {
        for (final Iterator<TickClient> i = tickers(); i.hasNext(); ) {
          final TickClient client = i.next();
          lastClient = client;
          // if(client.getCurrentTickDown()<=1)
          // currentThread.setName(oldThreadName+":"+getName()+":"+client.getName());
          if (client.tickTicker(false)) {
            delTicker(client); // cant do i.remove, its an streeset
          }
        }
      }
    } finally {
      lastStop = System.currentTimeMillis();
      milliTotal += (lastStop - lastStart);
      tickTotal++;
      currentThread = null;
      // Thread.currentThread().setName(oldThreadName);
    }
    if (tickers.size() == 0) {
      if (CMLib.threads() instanceof ServiceEngine)
        ((ServiceEngine) CMLib.threads()).delTickGroup(this);
    }
  }
Exemplo n.º 4
0
 @Override
 public void shutdown() {
   tickers.clear();
   if (CMLib.threads() instanceof ServiceEngine)
     ((ServiceEngine) CMLib.threads()).delTickGroup(this);
 }
Exemplo n.º 5
0
 @Override
 public void addTicker(TickClient C) {
   if (!tickers.contains(C)) tickers.add(C);
 }
Exemplo n.º 6
0
 @Override
 public void delTicker(TickClient C) {
   tickers.remove(C);
 }
Exemplo n.º 7
0
 @Override
 public int numTickers() {
   return tickers.size();
 }
Exemplo n.º 8
0
 @Override
 public Iterator<TickClient> tickers() {
   return tickers.iterator();
 }