idx
int64
0
41.2k
question
stringlengths
83
4.15k
target
stringlengths
5
715
12,000
public Listener < T > add ( Consumer < T > listener ) { Assert . notNull ( listener , "listener" ) ; ListenerHolder holder = new ListenerHolder ( listener , ThreadContext . currentContext ( ) ) ; listeners . add ( holder ) ; return holder ; }
Adds a listener to the set of listeners .
12,001
public CompletableFuture < Void > accept ( T event ) { List < CompletableFuture < Void > > futures = new ArrayList < > ( listeners . size ( ) ) ; for ( ListenerHolder listener : listeners ) { if ( listener . context != null ) { futures . add ( listener . context . execute ( ( ) -> listener . listener . accept ( event )...
Applies an event to all listeners .
12,002
private ThreadContext getOrCreateContext ( Channel channel ) { ThreadContext context = ThreadContext . currentContext ( ) ; if ( context != null ) { return context ; } return new SingleThreadContext ( Thread . currentThread ( ) , channel . eventLoop ( ) , this . context . serializer ( ) . clone ( ) ) ; }
Returns the current execution context or creates one .
12,003
private void handleResponse ( ByteBuf response , ChannelHandlerContext context ) { NettyConnection connection = getConnection ( context . channel ( ) ) ; if ( connection != null ) { connection . handleResponse ( response ) ; } }
Handles a response .
12,004
private int calculateTypeId ( Class < ? > type ) { if ( type == null ) throw new NullPointerException ( "type cannot be null" ) ; return hasher . hash32 ( type . getName ( ) ) ; }
Returns the type ID for the given class .
12,005
public SerializerRegistry registerDefault ( Class < ? > baseType , Class < ? extends TypeSerializer > serializer ) { return registerDefault ( baseType , new DefaultTypeSerializerFactory ( serializer ) ) ; }
Registers the given class as a default serializer for the given base type .
12,006
public synchronized SerializerRegistry registerDefault ( Class < ? > baseType , TypeSerializerFactory factory ) { defaultFactories . put ( baseType , factory ) ; return this ; }
Registers the given factory as a default serializer factory for the given base type .
12,007
private Class < ? > findBaseType ( Class < ? > type , Map < Class < ? > , TypeSerializerFactory > factories ) { if ( factories . containsKey ( type ) ) return type ; List < Map . Entry < Class < ? > , TypeSerializerFactory > > orderedFactories = new ArrayList < > ( factories . entrySet ( ) ) ; Collections . reverse ( o...
Finds a serializable base type for the given type in the given factories map .
12,008
synchronized int id ( Class < ? > type ) { Integer id = ids . get ( type ) ; if ( id != null ) return id ; Class < ? > baseType = findBaseType ( type , abstractFactories ) ; if ( baseType != null ) { id = ids . get ( baseType ) ; if ( id != null ) { return id ; } } return 0 ; }
Looks up the serializable type ID for the given type .
12,009
@ SuppressWarnings ( "unchecked" ) private T readReference ( Class < T > type , BufferInput < ? > buffer , Serializer serializer ) { ReferencePool < ? > pool = pools . get ( type ) ; if ( pool == null ) { Constructor < ? > constructor = constructorMap . get ( type ) ; if ( constructor == null ) { try { constructor = ty...
Reads an object reference .
12,010
private ReferenceFactory < ? > createFactory ( final Constructor < ? > constructor ) { return manager -> { try { return ( ReferenceCounted < ? > ) constructor . newInstance ( manager ) ; } catch ( InstantiationException | IllegalAccessException | InvocationTargetException e ) { throw new SerializationException ( "faile...
Dynamically created a reference factory for a pooled type .
12,011
@ SuppressWarnings ( "unchecked" ) private T readObject ( Class < T > type , BufferInput < ? > buffer , Serializer serializer ) { try { Constructor < ? > constructor = constructorMap . get ( type ) ; if ( constructor == null ) { try { constructor = type . getDeclaredConstructor ( ) ; constructor . setAccessible ( true ...
Reads an object .
12,012
private static File [ ] loadXmlFiles ( final File directory ) { return directory . listFiles ( new FileFilter ( ) { public boolean accept ( File file ) { return file . getName ( ) . endsWith ( ".xml" ) ; } } ) ; }
load all XML files listed in the directory specified
12,013
private static void generateJavaFiles ( final StatusUpdateTemplate template , final String workingPath ) throws FileNotFoundException { final String javaPath = WORKING_DIR + template . getName ( ) + ".java" ; final File javaFile = new File ( javaPath ) ; final String [ ] optionsAndSources = { "-classpath" , workingPath...
generate a java class file for the template specified
12,014
private static void storeStatusUpdateTemplate ( final AbstractGraphDatabase graphDatabase , final StatusUpdateTemplate template , final Node previousTemplateNode ) { final Transaction transaction = graphDatabase . beginTx ( ) ; try { final Node templateNode = StatusUpdateTemplate . createTemplateNode ( graphDatabase , ...
store the status update template linking to the latest previous version
12,015
public static void loadStatusUpdateTemplates ( final String rootDir , final Configuration config , final AbstractGraphDatabase graphDatabase ) throws ParserConfigurationException , SAXException , IOException { final String workingPath = rootDir + "classes/" ; final String targetPackage = StatusUpdate . class . getPacka...
load the status update allowed
12,016
public static StatusUpdate instantiateStatusUpdate ( final String typeIdentifier , final FormItemList values ) throws StatusUpdateInstantiationFailedException { final StatusUpdateTemplate template = getStatusUpdateTemplate ( typeIdentifier ) ; final Class < ? > templateInstantiationClass = template . getInstantiationCl...
instantiate a status update
12,017
public static DeleteUserRequest checkRequest ( final HttpServletRequest request , final DeleteRequest deleteRequest , final DeleteUserResponse deleteUserResponse ) { final Node user = checkUserIdentifier ( request , deleteUserResponse ) ; if ( user != null ) { return new DeleteUserRequest ( deleteRequest . getType ( ) ...
check a delete user request for validity concerning NSSP
12,018
public void addFriendById ( String userId , String name , FriendGroup friendGroup ) { if ( name == null && getRiotApi ( ) != null ) { try { name = getRiotApi ( ) . getName ( userId ) ; } catch ( final IOException e ) { e . printStackTrace ( ) ; } } try { connection . getRoster ( ) . createEntry ( StringUtils . parseBar...
Sends an friend request to an other user .
12,019
public boolean addFriendByName ( String name , FriendGroup friendGroup ) { if ( getRiotApi ( ) != null ) { try { final StringBuilder buf = new StringBuilder ( ) ; buf . append ( "sum" ) ; buf . append ( getRiotApi ( ) . getSummonerId ( name ) ) ; buf . append ( "@pvp.net" ) ; addFriendById ( buf . toString ( ) , name ,...
Sends an friend request to an other user . An Riot API key is required for this .
12,020
public FriendGroup addFriendGroup ( String name ) { final RosterGroup g = connection . getRoster ( ) . createGroup ( name ) ; if ( g != null ) { return new FriendGroup ( this , connection , g ) ; } return null ; }
Creates a new FriendGroup . If this FriendGroup contains no Friends when you logout it will be erased from the server .
12,021
public void disconnect ( ) { connection . getRoster ( ) . removeRosterListener ( leagueRosterListener ) ; try { connection . disconnect ( ) ; } catch ( final NotConnectedException e ) { e . printStackTrace ( ) ; } stop = true ; }
Disconnects from chatserver and releases all resources .
12,022
public Friend getFriend ( Filter < Friend > filter ) { for ( final RosterEntry e : connection . getRoster ( ) . getEntries ( ) ) { final Friend f = new Friend ( this , connection , e ) ; if ( filter . accept ( f ) ) { return f ; } } return null ; }
Gets a friend based on a given filter .
12,023
public Friend getFriendById ( String xmppAddress ) { final RosterEntry entry = connection . getRoster ( ) . getEntry ( StringUtils . parseBareAddress ( xmppAddress ) ) ; if ( entry != null ) { return new Friend ( this , connection , entry ) ; } return null ; }
Gets a friend based on his XMPPAddress .
12,024
public FriendGroup getFriendGroupByName ( String name ) { final RosterGroup g = connection . getRoster ( ) . getGroup ( name ) ; if ( g != null ) { return new FriendGroup ( this , connection , g ) ; } return addFriendGroup ( name ) ; }
Gets a FriendGroup by name for example Duo Partners . The name is case sensitive! The FriendGroup will be created if it didn t exist yet .
12,025
public List < FriendGroup > getFriendGroups ( ) { final ArrayList < FriendGroup > groups = new ArrayList < > ( ) ; for ( final RosterGroup g : connection . getRoster ( ) . getGroups ( ) ) { groups . add ( new FriendGroup ( this , connection , g ) ) ; } return groups ; }
Get a list of all your FriendGroups .
12,026
public List < Friend > getFriends ( ) { return getFriends ( new Filter < Friend > ( ) { public boolean accept ( Friend e ) { return true ; } } ) ; }
Get all your friends both online and offline .
12,027
public List < Friend > getFriends ( Filter < Friend > filter ) { final ArrayList < Friend > friends = new ArrayList < > ( ) ; for ( final RosterEntry e : connection . getRoster ( ) . getEntries ( ) ) { final Friend f = new Friend ( this , connection , e ) ; if ( filter . accept ( f ) ) { friends . add ( f ) ; } } retur...
Gets a list of your friends based on a given filter .
12,028
public String getName ( boolean forcedUpdate ) { if ( ( name == null || forcedUpdate ) && getRiotApi ( ) != null ) { try { name = getRiotApi ( ) . getName ( connection . getUser ( ) ) ; } catch ( final IOException e ) { e . printStackTrace ( ) ; } } return name ; }
Gets the name of the user that is logged in . An Riot API key has to be provided .
12,029
public List < Friend > getOfflineFriends ( ) { return getFriends ( new Filter < Friend > ( ) { public boolean accept ( Friend friend ) { return ! friend . isOnline ( ) ; } } ) ; }
Get all your friends who are offline .
12,030
public List < Friend > getOnlineFriends ( ) { return getFriends ( new Filter < Friend > ( ) { public boolean accept ( Friend friend ) { return friend . isOnline ( ) ; } } ) ; }
Get all your friends who are online .
12,031
public List < Friend > getPendingFriendRequests ( ) { return getFriends ( new Filter < Friend > ( ) { public boolean accept ( Friend friend ) { return friend . getFriendStatus ( ) == FriendStatus . ADD_REQUEST_PENDING ; } } ) ; }
Gets a list of user that you ve sent friend requests but haven t answered yet .
12,032
public int threads ( ) { int threads = reader . getInteger ( THREADS , DEFAULT_THREADS ) ; if ( threads == - 1 ) { return Runtime . getRuntime ( ) . availableProcessors ( ) ; } return threads ; }
The number of event loop threads .
12,033
public SslProtocol sslProtocol ( ) { String protocol = reader . getString ( SSL_PROTOCOL , DEFAULT_SSL_PROTOCOL ) . replace ( "." , "_" ) ; try { return SslProtocol . valueOf ( protocol ) ; } catch ( IllegalArgumentException e ) { throw new ConfigurationException ( "unknown SSL protocol: " + protocol , e ) ; } }
The SSL Protocol .
12,034
private void listen ( Address address , Consumer < Connection > listener , ThreadContext context ) { channelGroup = new DefaultChannelGroup ( "catalyst-acceptor-channels" , GlobalEventExecutor . INSTANCE ) ; handler = new ServerHandler ( connections , listener , context , transport . properties ( ) ) ; final ServerBoot...
Starts listening for the given member .
12,035
static Runnable logFailure ( final Runnable runnable , Logger logger ) { return ( ) -> { try { runnable . run ( ) ; } catch ( Throwable t ) { if ( ! ( t instanceof RejectedExecutionException ) ) { logger . error ( "An uncaught exception occurred" , t ) ; } throw t ; } } ; }
Returns a wrapped runnable that logs and rethrows uncaught exceptions .
12,036
public boolean delete ( ) { try { con . getRoster ( ) . removeEntry ( get ( ) ) ; return true ; } catch ( XMPPException | NotLoggedInException | NoResponseException | NotConnectedException e ) { e . printStackTrace ( ) ; } return false ; }
Deletes this friend .
12,037
public FriendStatus getFriendStatus ( ) { for ( final FriendStatus status : FriendStatus . values ( ) ) { if ( status . status == get ( ) . getStatus ( ) ) { return status ; } } return null ; }
Gets the relation between you and this friend .
12,038
public FriendGroup getGroup ( ) { final Collection < RosterGroup > groups = get ( ) . getGroups ( ) ; if ( groups . size ( ) > 0 ) { return new FriendGroup ( api , con , get ( ) . getGroups ( ) . iterator ( ) . next ( ) ) ; } return null ; }
Gets the FriendGroup that contains this friend .
12,039
public String getName ( boolean forcedUpdate ) { String name = get ( ) . getName ( ) ; if ( ( name == null || forcedUpdate ) && api . getRiotApi ( ) != null ) { try { name = api . getRiotApi ( ) . getName ( getUserId ( ) ) ; setName ( name ) ; } catch ( final IOException e ) { e . printStackTrace ( ) ; } } return name ...
Gets the name of this friend . If the name was null then we try to fetch the name with your Riot API Key if provided . Enable forcedUpdate to always fetch the latest name of this Friend even when the name is not null .
12,040
public void sendMessage ( String message ) { try { getChat ( ) . sendMessage ( message ) ; } catch ( XMPPException | NotConnectedException e ) { e . printStackTrace ( ) ; } }
Sends a message to this friend
12,041
@ SuppressWarnings ( "unchecked" ) protected void addStatusMessage ( final String statusMessage , final String solution ) { this . json . put ( ProtocolConstants . SOLUTION , solution ) ; this . json . put ( ProtocolConstants . STATUS_MESSAGE , statusMessage ) ; }
add a status message to the response
12,042
public void error ( final int errorCode , final String message ) { try { this . response . sendError ( errorCode , message ) ; } catch ( final IOException e ) { e . printStackTrace ( ) ; } }
abort the response with an error
12,043
protected AbstractBuffer reset ( long offset , long capacity , long maxCapacity ) { this . offset = offset ; this . capacity = 0 ; this . initialCapacity = capacity ; this . maxCapacity = maxCapacity ; capacity ( initialCapacity ) ; references . set ( 0 ) ; rewind ( ) ; return this ; }
Resets the buffer s internal offset and capacity .
12,044
protected void checkOffset ( long offset ) { if ( offset ( offset ) < this . offset ) { throw new IndexOutOfBoundsException ( ) ; } else if ( limit == - 1 ) { if ( offset > maxCapacity ) throw new IndexOutOfBoundsException ( ) ; } else { if ( offset > limit ) throw new IndexOutOfBoundsException ( ) ; } }
Checks that the offset is within the bounds of the buffer .
12,045
protected long checkSlice ( long offset , long length ) { checkOffset ( offset ) ; if ( limit == - 1 ) { if ( offset + length > capacity ) { if ( capacity < maxCapacity ) { capacity ( calculateCapacity ( offset + length ) ) ; } else { throw new BufferUnderflowException ( ) ; } } } else { if ( offset + length > limit ) ...
Checks bounds for a slice .
12,046
public static ReadRequest checkRequest ( final HttpServletRequest request , final ReadResponse readResponse ) { final Node user = checkUserIdentifier ( request , readResponse ) ; if ( user != null ) { final Node poster = checkPosterIdentifier ( request , readResponse ) ; if ( poster != null ) { final int numItems = che...
check a read request for validity concerning NSSP
12,047
private static Node checkPosterIdentifier ( final HttpServletRequest request , final ReadResponse response ) { final String posterId = request . getParameter ( ProtocolConstants . Parameters . Read . POSTER_IDENTIFIER ) ; if ( posterId != null ) { final Node user = NeoUtils . getUserByIdentifier ( posterId ) ; if ( use...
check if the request contains a valid poster identifier
12,048
private static int checkNumItems ( final HttpServletRequest request , final ReadResponse response ) { final String sNumItems = request . getParameter ( ProtocolConstants . Parameters . Read . NUM_ITEMS ) ; if ( sNumItems != null ) { int numItems ; try { numItems = Integer . valueOf ( sNumItems ) ; if ( numItems > 0 ) {...
check if the request contains a valid number of items to retrieve
12,049
private static Boolean checkOwnUpdates ( final HttpServletRequest request , final ReadResponse response ) { final String sOwnUpdates = request . getParameter ( ProtocolConstants . Parameters . Read . OWN_UPDATES ) ; if ( sOwnUpdates != null ) { try { final int iOwnUpdates = Integer . valueOf ( sOwnUpdates ) ; return ( ...
check if the request contains a valid retrieval flag
12,050
public SSLEngine initSslEngine ( boolean client ) throws Exception { KeyStore keyStore = loadKeystore ( properties . sslKeyStorePath ( ) , properties . sslKeyStorePassword ( ) ) ; KeyManagerFactory keyManagerFactory = KeyManagerFactory . getInstance ( KeyManagerFactory . getDefaultAlgorithm ( ) ) ; keyManagerFactory . ...
Initializes an SSL engine .
12,051
private void initialize ( ) throws IllegalArgumentException , IllegalAccessException { Field [ ] fields = this . getClass ( ) . getFields ( ) ; for ( Field f : fields ) { if ( this . getProperty ( f . getName ( ) ) == null ) { System . err . print ( "Property '" + f . getName ( ) + "' not defined in config file" ) ; } ...
Fills all fields with the data defined in the config file .
12,052
public int weightOf ( String suggestion ) { Node n = getNode ( suggestion ) ; return ( n != null ) ? n . weight : - 1 ; }
Returns the weight of the specified suggestion in this tree or - 1 if the tree does not contain the suggestion .
12,053
public void put ( String suggestion , int weight , String key ) { if ( suggestion . isEmpty ( ) || weight < 0 ) throw new IllegalArgumentException ( ) ; if ( root == null ) { root = new Node ( suggestion , weight , key , 0 , null ) ; size ++ ; return ; } int i = 0 ; Node n = root ; while ( true ) { if ( suggestion . ch...
Inserts the specified suggestion with the specified weight into this tree or assigns the specified new weight to the suggestion if it is already present .
12,054
public void remove ( String suggestion ) { Node n = getNode ( suggestion ) ; if ( n == null ) return ; n . weight = - 1 ; size -- ; Node m = n ; if ( n . mid == null ) { Node replacement = removeNode ( n ) ; if ( replacement != null ) replacement . parent = n . parent ; if ( n == root ) root = replacement ; else if ( n...
Removes the specified suggestion from this tree if present .
12,055
private void updateEgoNetwork ( final Node user ) { Node followedReplica , followingUser , lastPosterReplica ; Node prevReplica , nextReplica ; for ( Relationship relationship : user . getRelationships ( SocialGraphRelationshipType . REPLICA , Direction . INCOMING ) ) { followedReplica = relationship . getStartNode ( )...
update the ego network of a user
12,056
private void removeFromReplicaLayer ( final Node followedReplica ) { final Node prev = NeoUtils . getPrevSingleNode ( followedReplica , SocialGraphRelationshipType . GRAPHITY ) ; final Node next = NeoUtils . getNextSingleNode ( followedReplica , SocialGraphRelationshipType . GRAPHITY ) ; prev . getSingleRelationship ( ...
remove a followed user from the replica layer
12,057
private void updateReplicaLayerStatusUpdateDeletion ( final Node user , final Node statusUpdate ) { final Node lastUpdate = NeoUtils . getNextSingleNode ( user , SocialGraphRelationshipType . UPDATE ) ; if ( statusUpdate . equals ( lastUpdate ) ) { long newTimestamp = 0 ; final Node nextStatusUpdate = NeoUtils . getNex...
update the replica layer for status update deletion
12,058
private static long getLastUpdateByReplica ( final Node userReplica ) { final Node user = NeoUtils . getNextSingleNode ( userReplica , SocialGraphRelationshipType . REPLICA ) ; if ( user . hasProperty ( Properties . User . LAST_UPDATE ) ) { return ( long ) user . getProperty ( Properties . User . LAST_UPDATE ) ; } retu...
get a user s last recent status update s time stamp
12,059
public static CreateFollowRequest checkRequest ( final FormItemList formItemList , final CreateRequest createRequest , final CreateFollowResponse createFollowResponse ) { final Node user = checkUserIdentifier ( formItemList , createFollowResponse ) ; if ( user != null ) { final Node followed = checkFollowedIdentifier (...
check a create follow edge request for validity concerning NSSP
12,060
public boolean removeFooterView ( View v ) { if ( mFooterViewInfos . size ( ) > 0 ) { boolean result = false ; ListAdapter adapter = getAdapter ( ) ; if ( adapter != null && ( ( HeaderFooterViewGridAdapter ) adapter ) . removeFooter ( v ) ) { result = true ; } removeFixedViewInfo ( v , mFooterViewInfos ) ; return resul...
Removes a previously - added footer view .
12,061
public Messages reserve ( int numberOfMessages , int timeout , int wait ) throws IOException { if ( numberOfMessages < 1 || numberOfMessages > 100 ) { throw new IllegalArgumentException ( "numberOfMessages has to be within 1..100" ) ; } MessagesReservationModel payload = new MessagesReservationModel ( numberOfMessages ...
Retrieves Messages from the queue and reserves it . If there are no items on the queue an EmptyQueueException is thrown .
12,062
public Message peek ( ) throws IOException { Messages msgs = peek ( 1 ) ; Message msg ; try { msg = msgs . getMessage ( 0 ) ; } catch ( IndexOutOfBoundsException e ) { throw new EmptyQueueException ( ) ; } return msg ; }
Peeking at a queue returns the next messages on the queue but it does not reserve them . If there are no items on the queue an EmptyQueueException is thrown .
12,063
public Messages peek ( int numberOfMessages ) throws IOException { if ( numberOfMessages < 1 || numberOfMessages > 100 ) { throw new IllegalArgumentException ( "numberOfMessages has to be within 1..100" ) ; } IronReader reader = client . get ( "queues/" + name + "/messages?n=" + numberOfMessages ) ; try { return gson ....
Peeking at a queue returns the next messages on the queue but it does not reserve them .
12,064
public MessageOptions touchMessage ( String id , String reservationId , int timeout ) throws IOException { return touchMessage ( id , reservationId , ( long ) timeout ) ; }
Touching a reserved message extends its timeout to the specified duration .
12,065
public String push ( String msg , long delay ) throws IOException { Message message = new Message ( ) ; message . setBody ( msg ) ; message . setDelay ( delay ) ; Messages msgs = new Messages ( message ) ; IronReader reader = client . post ( "queues/" + name + "/messages" , msgs ) ; Ids ids = gson . fromJson ( reader ....
Pushes a message onto the queue .
12,066
public Ids pushMessages ( String [ ] msg , long delay ) throws IOException { ArrayList < Message > messages = new ArrayList < Message > ( ) ; for ( String messageName : msg ) { Message message = new Message ( ) ; message . setBody ( messageName ) ; message . setDelay ( delay ) ; messages . add ( message ) ; } MessagesA...
Pushes a messages onto the queue .
12,067
public QueueModel getInfoAboutQueue ( ) throws IOException { IronReader reader = client . get ( "queues/" + name ) ; QueueContainer queueContainer = gson . fromJson ( reader . reader , QueueContainer . class ) ; reader . close ( ) ; return queueContainer . getQueue ( ) ; }
Retrieves Info about queue . If there is no queue an EmptyQueueException is thrown .
12,068
public Message getMessageById ( String id ) throws IOException { String url = "queues/" + name + "/messages/" + id ; IronReader reader = client . get ( url ) ; MessageContainer container = gson . fromJson ( reader . reader , MessageContainer . class ) ; reader . close ( ) ; return container . getMessage ( ) ; }
Retrieves Message from the queue by message id . If there are no items on the queue an EmptyQueueException is thrown .
12,069
public void addSubscribers ( Subscribers subscribers ) throws IOException { String payload = gson . toJson ( subscribers ) ; IronReader reader = client . post ( "queues/" + name + "/subscribers" , payload ) ; reader . close ( ) ; }
Add subscribers to Queue . If there is no queue an EmptyQueueException is thrown .
12,070
public void replaceSubscribers ( Subscribers subscribers ) throws IOException { String payload = gson . toJson ( subscribers ) ; IronReader reader = client . put ( "queues/" + name + "/subscribers" , payload ) ; reader . close ( ) ; }
Sets list of subscribers to a queue . Older subscribers will be removed . If there is no queue an EmptyQueueException is thrown .
12,071
public void removeSubscribers ( Subscribers subscribers ) throws IOException { String url = "queues/" + name + "/subscribers" ; String jsonMessages = gson . toJson ( subscribers ) ; IronReader reader = client . delete ( url , jsonMessages ) ; reader . close ( ) ; }
Remove subscribers from Queue . If there is no queue an EmptyQueueException is thrown .
12,072
public SubscribersInfo getPushStatusForMessage ( String messageId ) throws IOException { String url = "queues/" + name + "/messages/" + messageId + "/subscribers" ; IronReader reader = client . get ( url ) ; SubscribersInfo subscribersInfo = gson . fromJson ( reader . reader , SubscribersInfo . class ) ; reader . close...
Get push info of message by message id . If there is no message an EmptyQueueException is thrown .
12,073
public void deletePushMessageForSubscriber ( String messageId , String reservationId , String subscriberName ) throws IOException { deleteMessage ( messageId , reservationId , subscriberName ) ; }
Delete push message for subscriber by subscriber ID and message ID . If there is no message or subscriber an EmptyQueueException is thrown .
12,074
public QueueModel updateAlerts ( ArrayList < Alert > alerts ) throws IOException { QueueModel payload = new QueueModel ( alerts ) ; return this . update ( payload ) ; }
Replace current queue alerts with a given list of alerts . If there is no queue an EmptyQueueException is thrown .
12,075
public void deleteAlertsFromQueue ( ArrayList < Alert > alert_ids ) throws IOException { String url = "queues/" + name + "/alerts" ; Alerts alert = new Alerts ( alert_ids ) ; String jsonMessages = gson . toJson ( alert ) ; IronReader reader = client . delete ( url , jsonMessages ) ; reader . close ( ) ; }
Delete alerts from a queue . If there is no queue an EmptyQueueException is thrown .
12,076
public void deleteAlertFromQueueById ( String alert_id ) throws IOException { String url = "queues/" + name + "/alerts/" + alert_id ; IronReader reader = client . delete ( url ) ; reader . close ( ) ; }
Delete alert from a queue by alert id . If there is no queue an EmptyQueueException is thrown .
12,077
public boolean isExpired ( int seconds ) { long diff = localIssuedAt . getTime ( ) - issuedAt . getTime ( ) ; long localExpiresAtTime = expiresAt . getTime ( ) + diff ; return ( new Date ( ) . getTime ( ) - seconds * 1000 ) >= localExpiresAtTime ; }
Indicated if token will expire after N seconds .
12,078
private void scheduleAcknowledgment ( final String topic ) { if ( ! acknowledgeScheduled . has ( topic ) ) { acknowledgeScheduled . set ( topic , true ) ; Platform . scheduler ( ) . scheduleDelay ( acknowledgeDelayMillis , new Handler < Void > ( ) { public void handle ( Void event ) { if ( acknowledgeScheduled . has ( ...
Acknowledgment Number is the next sequence number that the receiver is expecting
12,079
public FutureResultImpl < T > setFailure ( Throwable throwable ) { this . throwable = throwable ; failed = true ; checkCallHandler ( ) ; return this ; }
Set the failure . Any handler will be called if there is one
12,080
public FutureResultImpl < T > setHandler ( Handler < AsyncResult < T > > handler ) { this . handler = handler ; checkCallHandler ( ) ; return this ; }
Set a handler for the result . It will get called when it s complete
12,081
public FutureResultImpl < T > setResult ( T result ) { this . result = result ; succeeded = true ; checkCallHandler ( ) ; return this ; }
Set the result . Any handler will be called if there is one
12,082
public BackOffParameters next ( ) { int ret = Math . min ( nextBackOffTime , maxBackOff ) ; nextBackOffTime += backOffTime ; if ( nextBackOffTime <= 0 ) { nextBackOffTime = Integer . MAX_VALUE ; } backOffTime = ret ; int randomizeTime = ( int ) ( backOffTime * ( 1.0 + ( Math . random ( ) * randomizationFactor ) ) ) ; i...
Gets the next back off time . Until maxBackOff is reached .
12,083
public Object getItem ( ELContext context , int i ) { if ( originalListObject == null ) { originalListObject = orig . getValue ( context ) ; if ( originalListObject instanceof Collection ) { type = TypesEnum . ACollection ; } else if ( originalListObject instanceof Iterator ) { type = TypesEnum . AnIterator ; } else if...
Iterates the original expression and returns the value at the index .
12,084
public int doEndTag ( ) throws JspException { Object xmlText = this . xml ; if ( xmlText == null ) { if ( bodyContent != null && bodyContent . getString ( ) != null ) { xmlText = bodyContent . getString ( ) . trim ( ) ; } else { xmlText = "" ; } } if ( xmlText instanceof String ) { xmlText = new StringReader ( ( String...
parse source or body storing result in var
12,085
private Document parseInputSourceWithFilter ( InputSource s , XMLFilter f ) throws JspException { try { XMLReader xr = XmlUtil . newXMLReader ( entityResolver ) ; f . setParent ( xr ) ; TransformerHandler th = XmlUtil . newTransformerHandler ( ) ; Document o = XmlUtil . newEmptyDocument ( ) ; th . setResult ( new DOMRe...
Parses the given InputSource after applying the given XMLFilter .
12,086
private Document parseInputSource ( InputSource s ) throws JspException { try { DocumentBuilder db = XmlUtil . newDocumentBuilder ( ) ; db . setEntityResolver ( entityResolver ) ; return db . parse ( s ) ; } catch ( SAXException e ) { throw new JspException ( e ) ; } catch ( IOException e ) { throw new JspException ( e...
Parses the given InputSource into a Document .
12,087
public void setScope ( String scope ) { if ( scope . equalsIgnoreCase ( "page" ) ) { this . scope = PageContext . PAGE_SCOPE ; } else if ( scope . equalsIgnoreCase ( "request" ) ) { this . scope = PageContext . REQUEST_SCOPE ; } else if ( scope . equalsIgnoreCase ( "session" ) ) { this . scope = PageContext . SESSION_S...
Sets the scope attribute .
12,088
public static String getContentTypeAttribute ( String input , String name ) { int begin ; int end ; int index = input . toUpperCase ( ) . indexOf ( name . toUpperCase ( ) ) ; if ( index == - 1 ) { return null ; } index = index + name . length ( ) ; index = input . indexOf ( '=' , index ) ; if ( index == - 1 ) { return ...
Get the value associated with a content - type attribute . Syntax defined in RFC 2045 section 5 . 1 .
12,089
public Map getAsMap ( ) { if ( mMap != null ) { return mMap ; } else { Map m = convertToMap ( ) ; if ( ! isMutable ( ) ) { mMap = m ; } return m ; } }
Converts the MapSource to a Map . If the map is not mutable this is cached
12,090
Map convertToMap ( ) { Map ret = new HashMap ( ) ; for ( Enumeration e = enumerateKeys ( ) ; e . hasMoreElements ( ) ; ) { Object key = e . nextElement ( ) ; Object value = getValue ( key ) ; ret . put ( key , value ) ; } return ret ; }
Converts to a Map
12,091
public int doEndTag ( ) throws JspException { Tag t = findAncestorWithClass ( this , ParamParent . class ) ; if ( t == null ) { throw new JspTagException ( Resources . getMessage ( "PARAM_OUTSIDE_PARENT" ) ) ; } if ( name == null || name . equals ( "" ) ) { return EVAL_PAGE ; } ParamParent parent = ( ParamParent ) t ; ...
simply send our name and value to our appropriate ancestor
12,092
public static String [ ] union ( String [ ] arr1 , String [ ] arr2 ) { Set < String > set = new HashSet < String > ( ) ; for ( String str : arr1 ) { set . add ( str ) ; } for ( String str : arr2 ) { set . add ( str ) ; } String [ ] result = { } ; return set . toArray ( result ) ; }
Arr1 union Arr2
12,093
public static String [ ] intersect ( String [ ] arr1 , String [ ] arr2 ) { Map < String , Boolean > map = new HashMap < String , Boolean > ( ) ; LinkedList < String > list = new LinkedList < String > ( ) ; for ( String str : arr1 ) { if ( ! map . containsKey ( str ) ) { map . put ( str , Boolean . FALSE ) ; } } for ( S...
Arr1 intersect Arr2
12,094
public static String [ ] minus ( String [ ] arr1 , String [ ] arr2 ) { LinkedList < String > list = new LinkedList < String > ( ) ; LinkedList < String > history = new LinkedList < String > ( ) ; String [ ] longerArr = arr1 ; String [ ] shorterArr = arr2 ; if ( arr1 . length > arr2 . length ) { longerArr = arr2 ; short...
Arr1 minus Arr2
12,095
public int doEndTag ( ) throws JspException { try { conn . commit ( ) ; } catch ( SQLException e ) { throw new JspTagException ( Resources . getMessage ( "TRANSACTION_COMMIT_ERROR" , e . toString ( ) ) , e ) ; } return EVAL_PAGE ; }
Commits the transaction .
12,096
public void doCatch ( Throwable t ) throws Throwable { if ( conn != null ) { try { conn . rollback ( ) ; } catch ( SQLException e ) { } } throw t ; }
Rollbacks the transaction and rethrows the Throwable .
12,097
public void setIsolation ( String iso ) throws JspTagException { if ( TRANSACTION_READ_COMMITTED . equals ( iso ) ) { isolation = Connection . TRANSACTION_READ_COMMITTED ; } else if ( TRANSACTION_READ_UNCOMMITTED . equals ( iso ) ) { isolation = Connection . TRANSACTION_READ_UNCOMMITTED ; } else if ( TRANSACTION_REPEAT...
Setter method for the transaction isolation level .
12,098
public static BeanInfoManager getBeanInfoManager ( Class pClass ) { BeanInfoManager ret = ( BeanInfoManager ) mBeanInfoManagerByClass . get ( pClass ) ; if ( ret == null ) { ret = createBeanInfoManager ( pClass ) ; } return ret ; }
Returns the BeanInfoManager for the specified class
12,099
public static BeanInfoProperty getBeanInfoProperty ( Class pClass , String pPropertyName , Logger pLogger ) throws ELException { return getBeanInfoManager ( pClass ) . getProperty ( pPropertyName , pLogger ) ; }
Returns the BeanInfoProperty for the specified property in the given class or null if not found .