当前位置: 首页>>代码示例>>Java>>正文


Java FailureException类代码示例

本文整理汇总了Java中com.lightstreamer.interfaces.data.FailureException的典型用法代码示例。如果您正苦于以下问题:Java FailureException类的具体用法?Java FailureException怎么用?Java FailureException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


FailureException类属于com.lightstreamer.interfaces.data包,在下文中一共展示了FailureException类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: unsubscribe

import com.lightstreamer.interfaces.data.FailureException; //导入依赖的package包/类
@Override
public synchronized void unsubscribe(String item) throws SubscriptionException,
        FailureException {
    
    String val;
    if (( val = Constants.getVal(item,Constants.USER_SUBSCRIPTION)) != null) {
        logger.debug("User unsubscription: " + item);
        
        chat.stopUserMessageListen(val);
        
    } else if (( val = Constants.getVal(item,Constants.ROOMCHATLIST_SUBSCRIPTION)) != null) {
        logger.debug("Room list unsubscription: " + val);
        
        chat.stopRoomListen(val);
        
    } else if (( val = Constants.getVal(item,Constants.ROOMCHAT_SUBSCRIPTION)) != null) {
        logger.debug("Room chat unsubscription: " + val);
        
        chat.stopRoomChatListen(val);
        
    } else {
        logger.debug("User status unsubscription: " + item);
        
        chat.stopUserStatusListen(item);
    }
}
 
开发者ID:Lightstreamer,项目名称:BananaDarts-adapter-java,代码行数:27,代码来源:DartDataAdapter.java

示例2: unsubscribe

import com.lightstreamer.interfaces.data.FailureException; //导入依赖的package包/类
public void unsubscribe(String item) throws SubscriptionException,
        FailureException {

    if (item.equals(LIST)) {
        synchronized (listMutex) {
            assert(listHandle != null);
            listHandle = null;
        }

    } else if (item.startsWith(USER_PREFIX)) {
        String user = item.substring(USER_PREFIX.length());

        assert(subscriptions.containsKey(user));

        synchronized (listMutex) {
            subscriptions.remove(user);
            this.updateList("DELETE", user, false);
        }

    } else {
        throw new SubscriptionException("Unexpected item name: " + item);
    }

}
 
开发者ID:Lightstreamer,项目名称:Lightstreamer-example-Messenger-adapter-java,代码行数:25,代码来源:IMDataAdapter.java

示例3: subscribe

import com.lightstreamer.interfaces.data.FailureException; //导入依赖的package包/类
@Override
public synchronized void subscribe(String item, Object handle, boolean needsIterator)
        throws SubscriptionException, FailureException {

    String val;
    if (( val = Constants.getVal(item,Constants.USER_SUBSCRIPTION)) != null) {
        //DISTINCT used only to signal presence
        logger.debug("User subscription: " + item);
        
        //user is created on subscription and destroyed on unsubscription
        chat.startUserMessageListen(val,handle);
        
    } else if (( val = Constants.getVal(item,Constants.ROOMCHATLIST_SUBSCRIPTION)) != null) {
        //COMMAND contains users of a certain room
        logger.debug("Room list subscription: " + val);
        
        chat.startRoomListen(val,handle);// will add the room if non-existent (room may exist if a user entered it even if no one is listening to it)
    
    } else if (( val = Constants.getVal(item,Constants.ROOMCHAT_SUBSCRIPTION)) != null) {
        //DISTINCT chat for the room
        logger.debug("Room chat subscription: " + val);
        
        chat.startRoomChatListen(val,handle);
        
    } else {
        //MERGE subscription for user status and nick + their commands and positions 
        logger.debug("User status subscription: " + item);
        
        chat.startUserStatusListen(item,handle);
    }
}
 
开发者ID:Lightstreamer,项目名称:BananaDarts-adapter-java,代码行数:32,代码来源:DartDataAdapter.java

示例4: unsubscribe

import com.lightstreamer.interfaces.data.FailureException; //导入依赖的package包/类
public void unsubscribe(String itemName) throws SubscriptionException, FailureException {
	synchronized (this) {

		// Retrieve user's data (itemName is user's name)
		UserData userData= _userData.get(itemName);
		if (userData != null)
			userData.itemHandle= null;
	}
}
 
开发者ID:Lightstreamer,项目名称:Lightstreamer-example-FullScreenMario-adapter-java,代码行数:10,代码来源:DataAdapter.java

示例5: subscribe

import com.lightstreamer.interfaces.data.FailureException; //导入依赖的package包/类
public void subscribe(String itemName, Object itemHandle, boolean needsIterator) 
      throws SubscriptionException, FailureException {
  if (itemName.equals("greetings")) {
    gt = new GreetingsThread(itemHandle);
    gt.start();
  }
}
 
开发者ID:Lightstreamer,项目名称:Lightstreamer-example-AMFHelloWorld-adapter-java,代码行数:8,代码来源:AMFHelloWorld.java

示例6: subscribe

import com.lightstreamer.interfaces.data.FailureException; //导入依赖的package包/类
/**
  * Called by Lightstreamer Kernel on item subscription.
  */
 public void subscribe(String itemName, Object itemHandle, boolean needsIterator) throws SubscriptionException, FailureException {
     logger.info("Subscribing to " + itemName);

     //make some check to be sure we are subscribing to a valid item
     if (!isValidItem(itemName)) {
         //not a valid item
         throw new SubscriptionException("(Subscribing) Unexpected item: " + itemName);
     }

     logger.debug("(Subscribing) Valid item: " + itemName);

     //Generate an unique ID to represent the itemHandle object. This ID will be then
     //sent to the Generator which in turn will return it on each item update so that
     //the correct handle can be passed to the smartUpdate method.
     String uniqueId = String.valueOf(nextHandleId++);

     //create an object to contain some basic attributes for the item
     //this item will be useful for snapshot handling and unsubscription calls
     SubscribedItemAttributes itemAttrs = new SubscribedItemAttributes(itemName,uniqueId);

     //get the writelock to write inside the maps
     rwLock.writeLock().lock();
     logger.debug("------------------>Write LOCK 1");
         //insert item in the list of subscribed items
         //the item name will be the key, the attributes-object will be the value,
         subscribedItems.put(itemName, itemAttrs);
         //insert the handle in a map with the generated unique id as the key
         handles.put(uniqueId,itemHandle);

         boolean dispatchThread = false;
         if (lastHeartbeatRandom == -1) {
             //JMS is not available now, send the inactive flag to the clients
             //since this call is non-blocking we can issue it here
             dispatchInactiveFlag(itemAttrs);
         } else {
             //insert the subscription request to be dispatched to the Generator via JMS.
             //This request asks the Simulator to start dispatching the data flow
             //for this item. Note that it "enables" Generator to send data for this item
             //and not to "generate" values for this item. In fact, Generator begins the
             //production of values for all the items on startup.
             toSendRequests.offer("subscribe"+itemName+"_"+uniqueId);
             dispatchThread = true;
         }

     //release the lock
     logger.debug("------------------>Write UNLOCK 1");
     rwLock.writeLock().unlock();

     logger.debug("(Subscribing) Inserted in subscribed items list: " + itemName + " ("+uniqueId+")");

     if (dispatchThread) {
         //Start a thread to send the subscribe request to the Generator.
         //We should use something better like a pool of threads here, but for simplicity we start a new
         //thread each time we place some new request to be sent to the Generator inside the queue
         new SenderThread().start();
     }
}
 
开发者ID:Lightstreamer,项目名称:Lightstreamer-example-StockList-adapter-JMS,代码行数:61,代码来源:StockQuotesJMSDataAdapter.java

示例7: unsubscribe

import com.lightstreamer.interfaces.data.FailureException; //导入依赖的package包/类
/**
 * Called by Lightstreamer Kernel on item unsubscription.
 */
public void unsubscribe(String itemName) throws SubscriptionException, FailureException {
    logger.info("Unsubscribing from " + itemName);

    //get the writelock to check if the item is subscribed
    //and to eventually delete it
    rwLock.writeLock().lock();
    logger.debug("------------------>Write LOCK 2");
        //check if this is a subscribed item.
        if (!subscribedItems.containsKey(itemName)) {
            //before throw an exception must release the lock
            logger.debug("------------------>Write UNLOCK 2");
            rwLock.writeLock().unlock();
            //not subscribed item, throw an exception
            throw new SubscriptionException("(Unsubscribing) Unexpected item: " + itemName);
        }
        //get the object representing the unsubscribing item
        SubscribedItemAttributes item = subscribedItems.get(itemName);
        //remove the item from the subscribed items map
        subscribedItems.remove(itemName);
        //remove the handle from the handles map
        handles.remove(item.handleId);

        boolean dispatchThread = false;
        if (lastHeartbeatRandom != -1) {
            //insert the unsubscription request to be dispatched to the Generator via JMS.
            //This request asks the Simulator to stop dispatching the data flow
            //for this item (while the Generator keeps on producing the updates without
            //publishing them over JMS)
            toSendRequests.offer("unsubscribe"+itemName+"_"+item.handleId);
            dispatchThread = true;
        }

    //release the lock
    logger.debug("------------------>Write UNLOCK 2");
    rwLock.writeLock().unlock();

    logger.debug("(Unsubscribing) removed from subscribed items list:" + itemName + " (" + item.handleId + ")");

    if (dispatchThread) {
        //Start a thread to send the unsubscribe request to the Generator.
        //We should use something better like a pool of threads here, but for simplicity we start a new
        //thread each time we place some new request to be sent to the Generator inside the queue
        new SenderThread().start();
    }
}
 
开发者ID:Lightstreamer,项目名称:Lightstreamer-example-StockList-adapter-JMS,代码行数:49,代码来源:StockQuotesJMSDataAdapter.java

示例8: subscribe

import com.lightstreamer.interfaces.data.FailureException; //导入依赖的package包/类
public void subscribe(String arg0, boolean arg1)
        throws SubscriptionException, FailureException {
    //NEVER CALLED

}
 
开发者ID:Lightstreamer,项目名称:Lightstreamer-example-Messenger-adapter-java,代码行数:6,代码来源:IMDataAdapter.java

示例9: subscribe

import com.lightstreamer.interfaces.data.FailureException; //导入依赖的package包/类
public void subscribe(String itemName, boolean needsIterator) throws SubscriptionException, FailureException {
	assert(false); // Never called for a SmartDataProvider
}
 
开发者ID:Lightstreamer,项目名称:Lightstreamer-example-FullScreenMario-adapter-java,代码行数:4,代码来源:DataAdapter.java

示例10: subscribe

import com.lightstreamer.interfaces.data.FailureException; //导入依赖的package包/类
@Override
public void subscribe(String itemName, boolean needsIterator)
        throws SubscriptionException, FailureException {
    // Never Called.

}
 
开发者ID:Lightstreamer,项目名称:Lightstreamer-example-3DWorld-adapter-java,代码行数:7,代码来源:Move3dAdapter.java

示例11: unsubscribe

import com.lightstreamer.interfaces.data.FailureException; //导入依赖的package包/类
public void unsubscribe(String itemName) throws SubscriptionException,
      FailureException {
  if (itemName.equals("greetings") && gt != null) {
    gt.go = false;
  }
}
 
开发者ID:Lightstreamer,项目名称:Lightstreamer-example-AMFHelloWorld-adapter-java,代码行数:7,代码来源:AMFHelloWorld.java

示例12: subscribe

import com.lightstreamer.interfaces.data.FailureException; //导入依赖的package包/类
public void subscribe(String item, Object handle, boolean arg2)
        throws SubscriptionException, FailureException {

    assert(! subscriptions.containsKey(item));

    if (!item.matches("^roundtrip[01234]$")) {
        //valid items are in the range rountrip0 - roundtrip4
        throw new SubscriptionException("No such item");
    }

    // Add the new item to the list of subscribed items
    subscriptions.put(item, handle);
    
    //send the snapshot
    sendSnapshot(item);
    
    logger.info(item + " subscribed");

}
 
开发者ID:Lightstreamer,项目名称:Lightstreamer-example-RoundTrip-adapter-java,代码行数:20,代码来源:RoundTripDataAdapter.java

示例13: unsubscribe

import com.lightstreamer.interfaces.data.FailureException; //导入依赖的package包/类
public void unsubscribe(String item) throws SubscriptionException,
    FailureException {

    assert(subscriptions.containsKey(item));

    // Remove the handle from the list of subscribed items
    subscriptions.remove(item);

    logger.info(item + " unsubscribed");
}
 
开发者ID:Lightstreamer,项目名称:Lightstreamer-example-RoundTrip-adapter-java,代码行数:11,代码来源:RoundTripDataAdapter.java


注:本文中的com.lightstreamer.interfaces.data.FailureException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。