本文整理汇总了Java中com.lightstreamer.interfaces.data.SubscriptionException类的典型用法代码示例。如果您正苦于以下问题:Java SubscriptionException类的具体用法?Java SubscriptionException怎么用?Java SubscriptionException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SubscriptionException类属于com.lightstreamer.interfaces.data包,在下文中一共展示了SubscriptionException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: unsubscribe
import com.lightstreamer.interfaces.data.SubscriptionException; //导入依赖的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.SubscriptionException; //导入依赖的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.SubscriptionException; //导入依赖的package包/类
public void subscribe(String itemName, boolean needsIterator)
throws SubscriptionException {
logger.debug("Subscribing to " + itemName);
if (needsIterator) {
// OK, as we will always send HashMap objects
}
if (itemName.startsWith("item")) {
synchronized (subscribedItems) {
SubscriptionInfo si = new SubscriptionInfo(new Boolean(false), new Boolean(true));
subscribedItems.put(itemName, si);
}
// now we ask the feed for the snapshot; our feed will insert
// an event with snapshot information into the normal updates flow
myFeed.sendCurrentValues(itemName);
} else {
logger.error("Cannot subscribe to " + itemName + " - only names starting with \"item\" are supported");
throw new SubscriptionException("Unexpected item: " + itemName);
}
}
开发者ID:Lightstreamer,项目名称:Lightstreamer-example-StockList-adapter-java,代码行数:21,代码来源:StockQuotesDataAdapter.java
示例4: isSnapshotAvailable
import com.lightstreamer.interfaces.data.SubscriptionException; //导入依赖的package包/类
@Override
public boolean isSnapshotAvailable(String item)
throws SubscriptionException {
if (item.indexOf(Constants.USER_SUBSCRIPTION) == 0) {
return false; //currently does not generate any event at all (and never will)
} else if (item.indexOf(Constants.ROOMCHATLIST_SUBSCRIPTION) == 0) {
return true;
} else if (item.indexOf(Constants.ROOMCHAT_SUBSCRIPTION) == 0) {
return false;
} else {
return true;
}
}
开发者ID:Lightstreamer,项目名称:BananaDarts-adapter-java,代码行数:15,代码来源:DartDataAdapter.java
示例5: subscribe
import com.lightstreamer.interfaces.data.SubscriptionException; //导入依赖的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
示例6: isSnapshotAvailable
import com.lightstreamer.interfaces.data.SubscriptionException; //导入依赖的package包/类
/**
* Called by Lightstreamer Kernel to know if the snapshot
* is available for an item.
*/
public boolean isSnapshotAvailable(String itemName) throws SubscriptionException {
//we generate the updates so we can make snapshots always available (even if JMS is down
//we generate locally an "inactive" update)
return true;
//Note that if the adapter does not know the schema for the items, here we should return true
//only if data from the Generator is available:
// return (lastHeartbeatRandom != -1);
}
开发者ID:Lightstreamer,项目名称:Lightstreamer-example-StockList-adapter-JMS,代码行数:15,代码来源:StockQuotesJMSDataAdapter.java
示例7: isSnapshotAvailable
import com.lightstreamer.interfaces.data.SubscriptionException; //导入依赖的package包/类
public boolean isSnapshotAvailable(String item)
throws SubscriptionException {
if (item.equals(LIST)) {
return true;
}
return false;
}
开发者ID:Lightstreamer,项目名称:Lightstreamer-example-Messenger-adapter-java,代码行数:8,代码来源:IMDataAdapter.java
示例8: unsubscribe
import com.lightstreamer.interfaces.data.SubscriptionException; //导入依赖的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
示例9: isSnapshotAvailable
import com.lightstreamer.interfaces.data.SubscriptionException; //导入依赖的package包/类
@Override
public boolean isSnapshotAvailable(String itemName) throws SubscriptionException {
if (itemName.startsWith(CUSTOM_WORLD)) {
return true;
}
return false;
}
开发者ID:Lightstreamer,项目名称:Lightstreamer-example-3DWorld-adapter-java,代码行数:8,代码来源:Move3dAdapter.java
示例10: subscribe
import com.lightstreamer.interfaces.data.SubscriptionException; //导入依赖的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
示例11: subscribe
import com.lightstreamer.interfaces.data.SubscriptionException; //导入依赖的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
示例12: unsubscribe
import com.lightstreamer.interfaces.data.SubscriptionException; //导入依赖的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
示例13: subscribe
import com.lightstreamer.interfaces.data.SubscriptionException; //导入依赖的package包/类
public void subscribe(String arg0, boolean arg1)
throws SubscriptionException, FailureException {
//NEVER CALLED
}
开发者ID:Lightstreamer,项目名称:Lightstreamer-example-Messenger-adapter-java,代码行数:6,代码来源:IMDataAdapter.java
示例14: isSnapshotAvailable
import com.lightstreamer.interfaces.data.SubscriptionException; //导入依赖的package包/类
public boolean isSnapshotAvailable(String itemName) throws SubscriptionException {
return true;
}
开发者ID:Lightstreamer,项目名称:Lightstreamer-example-FullScreenMario-adapter-java,代码行数:4,代码来源:DataAdapter.java
示例15: subscribe
import com.lightstreamer.interfaces.data.SubscriptionException; //导入依赖的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
示例16: subscribe
import com.lightstreamer.interfaces.data.SubscriptionException; //导入依赖的package包/类
@Override
public void subscribe(String itemName, boolean needsIterator)
throws SubscriptionException, FailureException {
// Never Called.
}
开发者ID:Lightstreamer,项目名称:Lightstreamer-example-3DWorld-adapter-java,代码行数:7,代码来源:Move3dAdapter.java
示例17: isSnapshotAvailable
import com.lightstreamer.interfaces.data.SubscriptionException; //导入依赖的package包/类
public boolean isSnapshotAvailable(String itemName) throws SubscriptionException {
return false;
}
开发者ID:Lightstreamer,项目名称:Lightstreamer-example-AMFHelloWorld-adapter-java,代码行数:4,代码来源:AMFHelloWorld.java
示例18: unsubscribe
import com.lightstreamer.interfaces.data.SubscriptionException; //导入依赖的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
示例19: subscribe
import com.lightstreamer.interfaces.data.SubscriptionException; //导入依赖的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
示例20: isSnapshotAvailable
import com.lightstreamer.interfaces.data.SubscriptionException; //导入依赖的package包/类
public boolean isSnapshotAvailable(String arg0)
throws SubscriptionException {
//This adapter does not handle the snapshot.
//If there is someone subscribed the snapshot is kept by the server
return true;
}
开发者ID:Lightstreamer,项目名称:Lightstreamer-example-RoundTrip-adapter-java,代码行数:7,代码来源:RoundTripDataAdapter.java
注:本文中的com.lightstreamer.interfaces.data.SubscriptionException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论