idx int64 0 41.2k | question stringlengths 83 4.15k | target stringlengths 5 715 |
|---|---|---|
13,600 | public Transport combine ( Transport other ) { return getInstance ( _type . combine ( other . _type ) , ( _channel == other . _channel ) ? _channel : 0 ) ; } | Returns a transport that satisfies the requirements of this and the specified other transport . |
13,601 | public void broadcast ( Name from , String bundle , String msg , boolean attention , boolean forward ) { byte levelOrMode = ( from != null ) ? ChatCodes . BROADCAST_MODE : ( attention ? SystemMessage . ATTENTION : SystemMessage . INFO ) ; broadcast ( from , levelOrMode , bundle , msg , forward ) ; } | Broadcasts the specified message to all place objects in the system . |
13,602 | public void broadcast ( Name from , byte levelOrMode , String bundle , String msg , boolean forward ) { if ( _broadcastObject != null ) { broadcastTo ( _broadcastObject , from , levelOrMode , bundle , msg ) ; } else { for ( Iterator < PlaceObject > iter = _plreg . enumeratePlaces ( ) ; iter . hasNext ( ) ; ) { PlaceObj... | Broadcast with support for a customizable level or mode . |
13,603 | public void deliverTell ( UserMessage message , Name target , TellListener listener ) throws InvocationException { BodyObject tobj = _locator . lookupBody ( target ) ; if ( tobj == null ) { if ( _chatForwarder != null && _chatForwarder . forwardTell ( message , target , listener ) ) { return ; } throw new InvocationExc... | Delivers a tell message to the specified target and notifies the supplied listener of the result . It is assumed that the teller has already been permissions checked . |
13,604 | public void deliverTell ( BodyObject target , UserMessage message ) { SpeakUtil . sendMessage ( target , message ) ; SpeakUtil . noteMessage ( target , message . speaker , message ) ; } | Delivers a tell notification to the specified target player . It is assumed that the message is coming from some server entity and need not be permissions checked or notified of the result . |
13,605 | protected void broadcastTo ( DObject object , Name from , byte levelOrMode , String bundle , String msg ) { if ( from == null ) { SpeakUtil . sendSystem ( object , bundle , msg , levelOrMode ) ; } else { SpeakUtil . sendSpeak ( object , from , bundle , msg , levelOrMode ) ; } } | Direct a broadcast to the specified object . |
13,606 | public void appendReport ( StringBuilder report , long now , long sinceLast , boolean reset ) { PresentsConMgrStats stats = getStats ( ) ; long eventCount = stats . eventCount - _lastStats . eventCount ; int connects = stats . connects - _lastStats . connects ; int disconnects = stats . disconnects - _lastStats . disco... | from interface ReportManager . Reporter |
13,607 | public boolean setPrivateKey ( PrivateKey key ) { if ( SecureUtil . ciphersSupported ( key ) ) { _privateKey = key ; return true ; } return false ; } | Sets the private key if the ciphers are supported . |
13,608 | protected int handleDatagram ( DatagramChannel listener , long when ) { InetSocketAddress source ; _databuf . clear ( ) ; try { source = ( InetSocketAddress ) listener . receive ( _databuf ) ; } catch ( IOException ioe ) { log . warning ( "Failure receiving datagram." , ioe ) ; return 0 ; } if ( source == null ) { log ... | Called when a datagram message is ready to be read off its channel . |
13,609 | public void openOutgoingConnection ( Connection conn , String hostname , int port ) throws IOException { SocketChannel sockchan = SocketChannel . open ( ) ; sockchan . configureBlocking ( false ) ; conn . init ( this , sockchan , System . currentTimeMillis ( ) ) ; _connectq . append ( Tuple . newTuple ( conn , new Inet... | Opens an outgoing connection to the supplied address . The connection will be opened in a non - blocking manner and added to the connection manager s select set . Messages posted to the connection prior to it being actually connected to its destination will remain in the queue . If the connection fails those messages w... |
13,610 | protected void startOutgoingConnection ( final Connection conn , InetSocketAddress addr ) { final SocketChannel sockchan = conn . getChannel ( ) ; try { conn . selkey = sockchan . register ( _selector , SelectionKey . OP_CONNECT ) ; NetEventHandler handler ; if ( sockchan . connect ( addr ) ) { _outConnValidator . vali... | Starts the connection process for an outgoing connection . This is called as part of the conmgr tick for any pending outgoing connections . |
13,611 | protected void processAuthedConnections ( long iterStamp ) { AuthingConnection conn ; while ( ( conn = _authq . getNonBlocking ( ) ) != null ) { try { PresentsConnection rconn = new PresentsConnection ( ) ; rconn . init ( this , conn . getChannel ( ) , iterStamp ) ; rconn . selkey = conn . selkey ; rconn . inheritStrea... | Converts connections that have completed the authentication process into full running connections and notifies the client manager that new connections have been established . |
13,612 | protected boolean writeDatagram ( PresentsConnection conn , byte [ ] data ) { InetSocketAddress target = conn . getDatagramAddress ( ) ; if ( target == null ) { log . warning ( "No address to send datagram" , "conn" , conn ) ; return false ; } _databuf . clear ( ) ; _databuf . put ( data ) . flip ( ) ; try { return con... | Sends a datagram to the specified connection . |
13,613 | public OccupantInfo getOccupantInfo ( Name username ) { try { for ( OccupantInfo info : occupantInfo ) { if ( info . username . equals ( username ) ) { return info ; } } } catch ( Throwable t ) { log . warning ( "PlaceObject.getOccupantInfo choked." , t ) ; } return null ; } | Looks up a user s occupant info by name . |
13,614 | public static double getJulianDayNumber ( Calendar time ) { if ( time == null ) { time = GregorianCalendar . getInstance ( TimeZone . getTimeZone ( "GMT" ) ) ; } double jd = BASE_JD + time . getTimeInMillis ( ) / MILLISEC_PER_DAY ; return jd ; } | Calculate the Julian day number corresponding to the time provided |
13,615 | protected final int decodeLength ( ) { if ( _have < HEADER_SIZE ) { return - 1 ; } _buffer . rewind ( ) ; int length = ( _buffer . get ( ) & 0xFF ) << 24 ; length += ( _buffer . get ( ) & 0xFF ) << 16 ; length += ( _buffer . get ( ) & 0xFF ) << 8 ; length += ( _buffer . get ( ) & 0xFF ) ; _buffer . position ( _have ) ;... | Decodes and returns the length of the current frame from the buffer if possible . Returns - 1 otherwise . |
13,616 | public static void addExistingImports ( String asFile , ImportSet imports ) { Matcher m = AS_PUBLIC_CLASS_DECL . matcher ( asFile ) ; int searchTo = asFile . length ( ) ; if ( m . find ( ) ) { searchTo = m . start ( ) ; } m = AS_IMPORT . matcher ( asFile . substring ( 0 , searchTo ) ) ; while ( m . find ( ) ) { imports... | Adds an existing ActionScript file s imports to the given ImportSet . |
13,617 | public static void convertBaseClasses ( ImportSet imports ) { imports . replace ( "byte" , "com.threerings.util.Byte" ) ; imports . replace ( "boolean" , "com.threerings.util.langBoolean" ) ; imports . replace ( "[B" , "flash.utils.ByteArray" ) ; imports . replace ( "float" , "com.threerings.util.Float" ) ; imports . r... | Converts java types to their actionscript equivalents for ooo - style streaming . |
13,618 | public void noteClassMappingsReceived ( Collection < Class < ? > > sclasses ) { if ( _classmap == null ) { throw new RuntimeException ( "Missing class map" ) ; } for ( Class < ? > sclass : sclasses ) { ClassMapping cmap = _classmap . get ( sclass ) ; if ( cmap == null ) { throw new RuntimeException ( "No class mapping ... | Notes that the receiver has received the mappings for a group of classes and thus that from now on only the codes need be sent . |
13,619 | public void noteInternMappingsReceived ( Collection < String > sinterns ) { if ( _internmap == null ) { throw new RuntimeException ( "Missing intern map" ) ; } for ( String sintern : sinterns ) { Short code = _internmap . get ( sintern ) ; if ( code == null ) { throw new RuntimeException ( "No intern mapping for " + si... | Notes that the receiver has received the mappings for a group of interns and thus that from now on only the codes need be sent . |
13,620 | public void write ( int b ) throws IOException { int newcount = count + 1 ; if ( newcount > buf . length ) { buf = Arrays . copyOf ( buf , oversize ( newcount ) ) ; } buf [ count ] = ( byte ) b ; count = newcount ; } | Write an integer . |
13,621 | public void write ( byte [ ] b , int offset , int length ) throws IOException { if ( length == 0 ) { return ; } int newcount = count + length ; if ( newcount > buf . length ) { buf = Arrays . copyOf ( buf , oversize ( newcount ) ) ; } System . arraycopy ( b , offset , buf , count , length ) ; count = newcount ; } | Write byte array . |
13,622 | public void skip ( int length ) { int newcount = count + length ; if ( newcount > buf . length ) { buf = Arrays . copyOf ( buf , oversize ( newcount ) ) ; } count = newcount ; } | Skip a number of bytes . |
13,623 | public void parseEvents ( MarcXchangeEventConsumer consumer ) throws XMLStreamException { Objects . requireNonNull ( consumer ) ; if ( builder . getMarcListeners ( ) != null ) { for ( Map . Entry < String , MarcListener > entry : builder . getMarcListeners ( ) . entrySet ( ) ) { consumer . setMarcListener ( entry . get... | Run XML stream parser over an XML input stream with an XML event consumer . |
13,624 | public int wrapFields ( String type , ChunkStream < byte [ ] , BytesReference > stream , boolean withCollection ) throws IOException { int count = 0 ; MarcListener marcListener = builder . getMarcListener ( type ) ; if ( marcListener == null ) { return count ; } try { if ( withCollection ) { if ( marcListener instanceo... | Pass a given chunk stream to a MARC generator chunk by chunk . Can process any MARC streams not only separator streams . |
13,625 | public long wrapRecords ( ChunkStream < byte [ ] , BytesReference > stream , boolean withCollection ) throws IOException { final AtomicInteger l = new AtomicInteger ( ) ; try { MarcRecordListener marcRecordListener = builder . getMarcRecordListener ( ) ; if ( withCollection ) { if ( marcRecordListener instanceof Conten... | Wrap records into a collection . Can process any MARC streams not only separator streams . |
13,626 | protected void gotAuthResponse ( AuthResponse rsp ) throws LogonException { AuthResponseData data = rsp . getData ( ) ; if ( ! data . code . equals ( AuthResponseData . SUCCESS ) ) { throw new LogonException ( data . code ) ; } logonSucceeded ( data ) ; } | Subclasses must call this method when they receive the authentication response . |
13,627 | public void setAccessor ( Accessor < E > accessor ) { removeAll ( ) ; _accessor = accessor ; _table = new ObjectEditorTable ( _entryClass , _editableFields , _accessor . getInterp ( _interp ) , _displayFields ) ; add ( new JScrollPane ( _table ) , BorderLayout . CENTER ) ; } | Sets the logic for how this editor interacts with its underlying data . |
13,628 | protected void addEntry ( E entry ) { if ( _entryFilter == null || _entryFilter . apply ( entry ) ) { int index = _keys . insertSorted ( getKey ( entry ) ) ; _table . insertDatum ( entry , index ) ; } } | Handles the addition of an entry assuming our filter allows it . |
13,629 | protected void removeKey ( Comparable < ? > key ) { int index = _keys . indexOf ( key ) ; if ( index != - 1 ) { _keys . remove ( index ) ; _table . removeDatum ( index ) ; } } | Takes care of removing a key from |
13,630 | public void actionPerformed ( ActionEvent event ) { CommandEvent ce = ( CommandEvent ) event ; _accessor . updateEntry ( _setName , ( DSet . Entry ) ce . getArgument ( ) ) ; } | documentation inherited from interface ActionListener |
13,631 | public void clear ( String layerName ) { synchronized ( this ) { log . info ( "clearing cache for layer " + layerName ) ; for ( String key : cache . keySet ( ) ) { if ( key . contains ( layerName ) ) remove ( key ) ; } } } | TOOD improve this |
13,632 | public synchronized void put ( WmsRequest request , byte [ ] image ) { synchronized ( this ) { String key = getKey ( request ) ; keys . remove ( key ) ; keys . add ( key ) ; if ( keys . size ( ) > maxSize ) remove ( keys . get ( 0 ) ) ; if ( maxSize > 0 && layers . containsAll ( request . getLayers ( ) ) ) { cache . pu... | Sets the cached image for the request . |
13,633 | public static String cloneArgument ( Class < ? > dsclazz , Field field , String name ) { Class < ? > clazz = field . getType ( ) ; if ( clazz . isArray ( ) || dsclazz . equals ( clazz ) ) { return "(" + name + " == null) ? null : " + name + ".clone()" ; } else if ( dsclazz . isAssignableFrom ( clazz ) ) { return "(" + ... | Potentially clones the supplied argument if it is the type that needs such treatment . |
13,634 | public static String readClassName ( File source ) throws IOException { String pkgname = null , name = null ; BufferedReader bin = new BufferedReader ( new FileReader ( source ) ) ; String line ; while ( ( line = bin . readLine ( ) ) != null ) { Matcher pm = PACKAGE_PATTERN . matcher ( line ) ; if ( pm . find ( ) ) { p... | Reads in the supplied source file and locates the package and class or interface name and returns a fully qualified class name . |
13,635 | public void bodyRemovedFromChannel ( ChatChannel channel , final int bodyId ) { _peerMan . invokeNodeAction ( new ChannelAction ( channel ) { protected void execute ( ) { ChannelInfo info = _channelMan . _channels . get ( _channel ) ; if ( info != null ) { info . participants . remove ( bodyId ) ; } else if ( _channelM... | When a body loses channel membership this method should be called so that any server that happens to be hosting that channel can be told that the body in question is now a participant . |
13,636 | public void collectChatHistory ( final Name user , final ResultListener < ChatHistoryResult > lner ) { _peerMan . invokeNodeRequest ( new NodeRequest ( ) { public boolean isApplicable ( NodeObject nodeobj ) { return true ; } protected void execute ( InvocationService . ResultListener listener ) { listener . requestProc... | Collects all chat messages heard by the given user on all peers . |
13,637 | public void speak ( ClientObject caller , final ChatChannel channel , String message , byte mode ) { BodyObject body = _locator . forClient ( caller ) ; final UserMessage umsg = new UserMessage ( body . getVisibleName ( ) , null , message , mode ) ; if ( _channels . containsKey ( channel ) ) { dispatchSpeak ( channel ,... | from interface ChannelSpeakProvider |
13,638 | protected void resolveAndDispatch ( final ChatChannel channel ) { NodeObject . Lock lock = new NodeObject . Lock ( "ChatChannel" , channel . getLockName ( ) ) ; _peerMan . performWithLock ( lock , new PeerManager . LockedOperation ( ) { public void run ( ) { ( ( CrowdNodeObject ) _peerMan . getNodeObject ( ) ) . addToH... | Resolves the channel specified in the supplied action and then dispatches it . |
13,639 | protected void resolutionComplete ( ChatChannel channel , Set < Integer > parts ) { ChannelInfo info = new ChannelInfo ( ) ; info . channel = channel ; info . participants = parts ; _channels . put ( channel , info ) ; for ( UserMessage msg : _resolving . remove ( channel ) ) { dispatchSpeak ( channel , msg ) ; } } | This should be called when a channel s participant set has been resolved . |
13,640 | protected void resolutionFailed ( ChatChannel channel , Exception cause ) { log . warning ( "Failed to resolve chat channel" , "channel" , channel , cause ) ; _resolving . remove ( channel ) ; } | This should be called if channel resolution fails . |
13,641 | protected void dispatchSpeak ( ChatChannel channel , final UserMessage message ) { final ChannelInfo info = _channels . get ( channel ) ; if ( info == null ) { log . warning ( "Requested to dispatch speak on unhosted channel" , "channel" , channel , "msg" , message ) ; return ; } if ( ! info . participants . contains (... | Requests that we dispatch the supplied message to all participants of the specified chat channel . The speaker will be validated prior to dispatching the message as the originating server does not have the information it needs to validate the speaker and must leave that to us the channel hosting server . |
13,642 | protected void deliverSpeak ( ChatChannel channel , UserMessage message , int [ ] bodyIds ) { channel = intern ( channel ) ; for ( int bodyId : bodyIds ) { BodyObject bobj = getBodyObject ( bodyId ) ; if ( bobj != null && shouldDeliverSpeak ( channel , message , bobj ) ) { _chatHistory . record ( channel , bobj . getCh... | Delivers the supplied chat channel message to the specified bodies . |
13,643 | protected void closeIdleChannels ( ) { long now = System . currentTimeMillis ( ) ; Iterator < Map . Entry < ChatChannel , ChannelInfo > > iter = _channels . entrySet ( ) . iterator ( ) ; while ( iter . hasNext ( ) ) { Map . Entry < ChatChannel , ChannelInfo > entry = iter . next ( ) ; if ( now - entry . getValue ( ) . ... | Called periodically to check for and close any channels that have been idle too long . |
13,644 | protected ChatChannel intern ( ChatChannel channel ) { ChannelInfo chinfo = _channels . get ( channel ) ; if ( chinfo != null ) { return chinfo . channel ; } return channel ; } | Returns a widely referenced instance equivalent to the given channel if one is available . This reduces memory usage since clients send new channel instances with each message . |
13,645 | public static < E extends Enum < E > > StreamableEnumSet < E > noneOf ( Class < E > elementType ) { return new StreamableEnumSet < E > ( elementType ) ; } | Creates an empty set of the specified type . |
13,646 | public static < E extends Enum < E > > StreamableEnumSet < E > allOf ( Class < E > elementType ) { StreamableEnumSet < E > set = new StreamableEnumSet < E > ( elementType ) ; for ( E constant : elementType . getEnumConstants ( ) ) { set . add ( constant ) ; } return set ; } | Creates a set containing all elements of the specified type . |
13,647 | public static < E extends Enum < E > > StreamableEnumSet < E > copyOf ( StreamableEnumSet < E > s ) { return s . clone ( ) ; } | Creates a set containing all elements in the set provided . |
13,648 | public static < E extends Enum < E > > StreamableEnumSet < E > of ( E first , E ... rest ) { StreamableEnumSet < E > set = new StreamableEnumSet < E > ( first . getDeclaringClass ( ) ) ; set . add ( first ) ; for ( E e : rest ) { set . add ( e ) ; } return set ; } | Creates a set consisting of the specified elements . |
13,649 | public boolean add ( int oid ) { for ( int ii = 0 ; ii < _size ; ii ++ ) { if ( _oids [ ii ] == oid ) { return false ; } } if ( _size + 1 >= _oids . length ) { expand ( ) ; } _oids [ _size ++ ] = oid ; return true ; } | Adds the specified object id to the list if it is not already there . |
13,650 | public boolean remove ( int oid ) { for ( int ii = 0 ; ii < _size ; ii ++ ) { if ( _oids [ ii ] == oid ) { System . arraycopy ( _oids , ii + 1 , _oids , ii , -- _size - ii ) ; return true ; } } return false ; } | Removes the specified oid from the list . |
13,651 | public boolean contains ( int oid ) { for ( int ii = 0 ; ii < _size ; ii ++ ) { if ( _oids [ ii ] == oid ) { return true ; } } return false ; } | Returns true if the specified oid is in the list false if not . |
13,652 | public JPanel getEditor ( PresentsContext ctx , Field field ) { if ( field . getType ( ) . equals ( Boolean . TYPE ) ) { return new BooleanFieldEditor ( ctx , field , this ) ; } else { return new AsStringFieldEditor ( ctx , field , this ) ; } } | Returns the editor panel for the specified field . |
13,653 | public void getConfigInfo ( AdminService . ConfigInfoListener arg1 ) { AdminMarshaller . ConfigInfoMarshaller listener1 = new AdminMarshaller . ConfigInfoMarshaller ( ) ; listener1 . listener = arg1 ; sendRequest ( GET_CONFIG_INFO , new Object [ ] { listener1 } ) ; } | from interface AdminService |
13,654 | public void dispatchRequest ( ClientObject source , int methodId , Object [ ] args ) throws InvocationException { log . warning ( "Requested to dispatch unknown method" , "provider" , provider , "sourceOid" , source . getOid ( ) , "methodId" , methodId , "args" , args ) ; } | Dispatches the specified method to our provider . |
13,655 | public void speak ( String arg1 , byte arg2 ) { sendRequest ( SPEAK , new Object [ ] { arg1 , Byte . valueOf ( arg2 ) } ) ; } | from interface SpeakService |
13,656 | public static boolean isBlank ( Name name ) { return ( name == null || name . toString ( ) . equals ( BLANK . toString ( ) ) ) ; } | Returns true if this name is null or blank false if it contains useful data . This works on derived classes as well . |
13,657 | public String getNormal ( ) { if ( _normal == null ) { _normal = normalize ( _name ) ; if ( _normal . equals ( _name ) ) { _normal = _name ; } } return _normal ; } | Returns the normalized version of this name . |
13,658 | public boolean scheduleRegularReboot ( ) { int freq = getDayFrequency ( ) ; int hour = getRebootHour ( ) ; if ( freq <= 0 ) { return false ; } Calendars . Builder cal = Calendars . now ( ) ; int curHour = cal . get ( Calendar . HOUR_OF_DAY ) ; cal = cal . zeroTime ( ) . addHours ( hour ) . addDays ( ( curHour < hour ) ... | Schedules our next regularly scheduled reboot . |
13,659 | public void cancelReboot ( ) { if ( _interval != null ) { _interval . cancel ( ) ; _interval = null ; } _nextReboot = 0L ; _rebootSoon = false ; _initiator = null ; } | Cancel the currently scheduled reboot if any . |
13,660 | public int preventReboot ( String whereFrom ) { if ( whereFrom == null ) { throw new IllegalArgumentException ( "whereFrom must be descriptive." ) ; } int lockId = _nextRebootLockId ++ ; _rebootLocks . put ( lockId , whereFrom ) ; return lockId ; } | Called by an entity that would like to prevent a reboot . |
13,661 | protected void scheduleReboot ( long rebootTime , boolean exact , String initiator ) { cancelReboot ( ) ; long now = System . currentTimeMillis ( ) ; rebootTime = Math . max ( rebootTime , now ) ; long delay = rebootTime - now ; int [ ] warnings = getWarnings ( ) ; int level = - 1 ; for ( int ii = warnings . length - 1... | Schedule a reboot . |
13,662 | protected String getRebootMessage ( String key , int minutes ) { String msg = getCustomRebootMessage ( ) ; if ( StringUtil . isBlank ( msg ) ) { msg = "m.reboot_msg_standard" ; } return MessageBundle . compose ( key , MessageBundle . taint ( "" + minutes ) , msg ) ; } | Composes the given reboot message with the minutes and either the custom or standard details about the pending reboot . |
13,663 | protected void doWarning ( int level , int minutes ) { _rebootSoon = ( level > - 1 ) ; int [ ] warnings = getWarnings ( ) ; if ( level == warnings . length ) { if ( checkLocks ( ) ) { return ; } log . info ( "Performing automatic server reboot/shutdown, as scheduled by: " + _initiator ) ; broadcast ( "m.rebooting_now" ... | Do a warning schedule the next . |
13,664 | protected boolean checkLocks ( ) { if ( _rebootLocks . isEmpty ( ) ) { return false ; } log . info ( "Reboot delayed due to outstanding locks" , "locks" , _rebootLocks . elements ( ) ) ; broadcast ( "m.reboot_delayed" ) ; ( _interval = _omgr . newInterval ( new Runnable ( ) { public void run ( ) { doWarning ( getWarnin... | Check to see if there are outstanding reboot locks that may delay the reboot returning false if there are none . |
13,665 | protected void notifyObservers ( int level ) { final int warningsLeft = getWarnings ( ) . length - level - 1 ; final long msLeft = _nextReboot - System . currentTimeMillis ( ) ; _observers . apply ( new ObserverList . ObserverOp < PendingShutdownObserver > ( ) { public boolean apply ( PendingShutdownObserver observer )... | Notify all PendingShutdownObservers of the pending shutdown! |
13,666 | public void registerFlushDelay ( Class < ? > objclass , long delay ) { _delays . put ( objclass , Long . valueOf ( delay ) ) ; } | Registers an object flush delay . |
13,667 | public void processMessage ( Message msg ) { if ( _client . getRunQueue ( ) . isRunning ( ) ) { _actions . append ( msg ) ; _client . getRunQueue ( ) . postRunnable ( this ) ; } else { log . info ( "Dropping message as RunQueue is shutdown" , "msg" , msg ) ; } } | Called by the communicator when a message arrives from the network layer . We queue it up for processing and request some processing time on the main thread . |
13,668 | public void cleanup ( ) { for ( PendingRequest < ? > req : _penders . values ( ) ) { for ( Subscriber < ? > sub : req . targets ) { sub . requestFailed ( req . oid , new ObjectAccessException ( "Client connection closed" ) ) ; } } _penders . clear ( ) ; _flusher . cancel ( ) ; _flushes . clear ( ) ; _dead . clear ( ) ;... | Called when the client is cleaned up due to having disconnected from the server . |
13,669 | protected void dispatchEvent ( DEvent event ) { int remoteOid = event . getTargetOid ( ) ; DObject target = _ocache . get ( remoteOid ) ; if ( target == null ) { if ( ! _dead . containsKey ( remoteOid ) ) { log . warning ( "Unable to dispatch event on non-proxied object " + event + "." ) ; } return ; } _client . conver... | Called when a new event arrives from the server that should be dispatched to subscribers here on the client . |
13,670 | protected void dispatchEvent ( int remoteOid , DObject target , DEvent event ) { try { boolean notify = event . applyToObject ( target ) ; if ( event instanceof ObjectDestroyedEvent ) { _ocache . remove ( remoteOid ) ; } if ( notify ) { target . notifyListeners ( event ) ; } } catch ( Exception e ) { log . warning ( "F... | Dispatches an event on an already resolved target object . |
13,671 | protected < T extends DObject > void registerObjectAndNotify ( ObjectResponse < T > orsp ) { T obj = orsp . getObject ( ) ; obj . setManager ( this ) ; _ocache . put ( obj . getOid ( ) , obj ) ; PendingRequest < ? > req = _penders . remove ( obj . getOid ( ) ) ; if ( req == null ) { log . warning ( "Got object, but no ... | Registers this object in our proxy cache and notifies the subscribers that were waiting for subscription to this object . |
13,672 | protected void flushObject ( DObject obj ) { int ooid = obj . getOid ( ) ; _ocache . remove ( ooid ) ; _dead . put ( ooid , obj ) ; _comm . postMessage ( new UnsubscribeRequest ( ooid ) ) ; } | Flushes a distributed object subscription issuing an unsubscribe request to the server . |
13,673 | protected void flushObjects ( ) { long now = System . currentTimeMillis ( ) ; for ( Iterator < IntMap . IntEntry < FlushRecord > > iter = _flushes . intEntrySet ( ) . iterator ( ) ; iter . hasNext ( ) ; ) { IntMap . IntEntry < FlushRecord > entry = iter . next ( ) ; FlushRecord rec = entry . getValue ( ) ; if ( rec . e... | Called periodically to flush any objects that have been lingering due to a previously enacted flush delay . |
13,674 | public static Cipher getAESCipher ( int mode , byte [ ] key ) { try { Cipher cipher = Cipher . getInstance ( "AES/CBC/PKCS5Padding" ) ; SecretKeySpec aesKey = new SecretKeySpec ( key , "AES" ) ; cipher . init ( mode , aesKey , IVPS ) ; return cipher ; } catch ( GeneralSecurityException gse ) { log . warning ( "Failed t... | Creates our AES cipher . |
13,675 | public static Cipher getRSACipher ( int mode , Key key ) { try { Cipher cipher = Cipher . getInstance ( "RSA" ) ; cipher . init ( mode , key ) ; return cipher ; } catch ( GeneralSecurityException gse ) { log . warning ( "Failed to create cipher" , gse ) ; } return null ; } | Creates our RSA cipher . |
13,676 | public static KeyPair genRSAKeyPair ( int bits ) { try { KeyPairGenerator kpg = KeyPairGenerator . getInstance ( "RSA" ) ; kpg . initialize ( bits ) ; return kpg . genKeyPair ( ) ; } catch ( GeneralSecurityException gse ) { log . warning ( "Failed to create key pair" , gse ) ; } return null ; } | Creates an RSA key pair . |
13,677 | public static PublicKey stringToRSAPublicKey ( String str ) { try { BigInteger mod = new BigInteger ( str . substring ( 0 , str . indexOf ( SPLIT ) ) , 16 ) ; BigInteger exp = new BigInteger ( str . substring ( str . indexOf ( SPLIT ) + 1 ) , 16 ) ; RSAPublicKeySpec keySpec = new RSAPublicKeySpec ( mod , exp ) ; KeyFac... | Creates a public key from the supplied string . |
13,678 | public static PrivateKey stringToRSAPrivateKey ( String str ) { try { BigInteger mod = new BigInteger ( str . substring ( 0 , str . indexOf ( SPLIT ) ) , 16 ) ; BigInteger exp = new BigInteger ( str . substring ( str . indexOf ( SPLIT ) + 1 ) , 16 ) ; RSAPrivateKeySpec keySpec = new RSAPrivateKeySpec ( mod , exp ) ; Ke... | Creates a private key from the supplied string . |
13,679 | public static byte [ ] encryptBytes ( PublicKey key , byte [ ] secret , byte [ ] salt ) { byte [ ] encrypt = new byte [ secret . length + salt . length ] ; for ( int ii = 0 ; ii < secret . length ; ii ++ ) { encrypt [ ii ] = secret [ ii ] ; } for ( int ii = 0 ; ii < salt . length ; ii ++ ) { encrypt [ secret . length +... | Encrypts a secret key and salt with a public key . |
13,680 | public static byte [ ] decryptBytes ( PrivateKey key , byte [ ] encrypted , byte [ ] salt ) { try { byte [ ] decrypted = getRSACipher ( key ) . doFinal ( encrypted ) ; for ( int ii = 0 ; ii < salt . length ; ii ++ ) { if ( decrypted [ decrypted . length - salt . length + ii ] != salt [ ii ] ) { return null ; } } byte [... | Decrypts a secret key and checks for tailing salt . |
13,681 | public static byte [ ] xorBytes ( byte [ ] data , byte [ ] key ) { byte [ ] xored = new byte [ data . length ] ; for ( int ii = 0 ; ii < data . length ; ii ++ ) { xored [ ii ] = ( byte ) ( data [ ii ] ^ key [ ii % key . length ] ) ; } return xored ; } | XORs a byte array against a key . |
13,682 | public void commit ( ) { clearTarget ( ) ; int size = _events . size ( ) ; switch ( size ) { case 0 : break ; case 1 : _omgr . postEvent ( _events . get ( 0 ) ) ; break ; default : _transport = _events . get ( 0 ) . getTransport ( ) ; for ( int ii = 1 ; ii < size ; ii ++ ) { _transport = _events . get ( ii ) . getTrans... | Commits this transaction by posting this event to the distributed object event queue . All participating dobjects will have their transaction references cleared and will go back to normal operation . |
13,683 | public PlaceConfig moveTo ( BodyObject source , int placeOid ) throws InvocationException { PlaceManager pmgr = _plreg . getPlaceManager ( placeOid ) ; if ( pmgr == null ) { log . info ( "Requested to move to non-existent place" , "who" , source . who ( ) , "placeOid" , placeOid ) ; throw new InvocationException ( NO_S... | Moves the specified body from whatever location they currently occupy to the location identified by the supplied place oid . |
13,684 | public void leaveOccupiedPlace ( BodyObject source ) { Place oldloc = source . location ; if ( oldloc == null ) { return ; } PlaceManager pmgr = _plreg . getPlaceManager ( oldloc . placeOid ) ; if ( pmgr == null ) { log . warning ( "Body requested to leave no longer existent place?" , "boid" , source . getOid ( ) , "pl... | Removes the specified body from the place object they currently occupy . Does nothing if the body is not currently in a place . |
13,685 | public void init ( int invOid , int invCode , InvocationDirector invDir ) { _invOid = invOid ; _invCode = invCode ; _invdir = invDir ; } | Initializes this invocation marshaller instance with the requisite information to allow it to operate in the wide world . This is called by the invocation manager when an invocation provider is registered and should not be called otherwise . |
13,686 | protected void sendRequest ( int methodId , Object [ ] args , Transport transport ) { _invdir . sendRequest ( _invOid , _invCode , methodId , args , transport ) ; } | Called by generated invocation marshaller code ; packages up and sends the specified invocation service request . |
13,687 | public static FieldMarshaller getFieldMarshaller ( Field field ) { if ( _marshallers == null ) { _marshallers = createMarshallers ( ) ; } if ( useFieldAccessors ( ) ) { Method reader = null , writer = null ; try { reader = field . getDeclaringClass ( ) . getMethod ( getReaderMethodName ( field . getName ( ) ) , READER_... | Returns a field marshaller appropriate for the supplied field or null if no marshaller exists for the type contained by the field in question . |
13,688 | protected void sendOutgoingMessages ( long iterStamp ) { if ( _oflowqs . size ( ) > 0 ) { for ( OverflowQueue oq : _oflowqs . values ( ) . toArray ( new OverflowQueue [ _oflowqs . size ( ) ] ) ) { try { if ( oq . writeOverflowMessages ( iterStamp ) ) { _oflowqs . remove ( oq . conn ) ; } } catch ( IOException ioe ) { o... | Writes all queued overflow and normal messages to their respective sockets . Connections that already have established overflow queues will have their messages appended to their overflow queue instead so that they are delivered in the proper order . |
13,689 | protected boolean writeMessage ( Connection conn , byte [ ] data , PartialWriteHandler pwh ) { if ( conn . isClosed ( ) ) { return true ; } if ( data == ASYNC_CLOSE_REQUEST ) { closeConnection ( conn ) ; return true ; } if ( data . length > 1024 * 1024 ) { log . warning ( "Refusing to write very large message" , "conn"... | Writes a message out to a connection passing the buck to the partial write handler if the entire message could not be written . |
13,690 | protected void connectionFailed ( Connection conn , IOException ioe ) { _handlers . remove ( conn . selkey ) ; _connections . remove ( conn . getConnectionId ( ) ) ; _oflowqs . remove ( conn ) ; synchronized ( this ) { _stats . disconnects ++ ; } } | Called by a connection if it experiences a network failure . |
13,691 | protected void connectionClosed ( Connection conn ) { _handlers . remove ( conn . selkey ) ; _connections . remove ( conn . getConnectionId ( ) ) ; _oflowqs . remove ( conn ) ; synchronized ( this ) { _stats . closes ++ ; } } | Called by a connection when it discovers that it s closed . |
13,692 | public static < K , V > StreamableHashMap < K , V > newMap ( Map < ? extends K , ? extends V > map ) { return new StreamableHashMap < K , V > ( map ) ; } | Creates StreamableHashMap populated with the same values as the provided Map . |
13,693 | public void shutdown ( ) { if ( _chatdir != null ) { _chatdir . removeChatFilter ( this ) ; _chatdir = null ; } _ctx . getClient ( ) . removeClientObserver ( this ) ; } | Called to shut down the mute director . |
13,694 | public void setMuted ( Name username , boolean mute ) { boolean changed = mute ? _mutelist . add ( username ) : _mutelist . remove ( username ) ; String feedback ; if ( mute ) { feedback = "m.muted" ; } else { feedback = changed ? "m.unmuted" : "m.notmuted" ; } _chatdir . displayFeedback ( null , MessageBundle . tcompo... | Mute or unmute the specified user . |
13,695 | public String filter ( String msg , Name otherUser , boolean outgoing ) { if ( ( otherUser != null ) && isMuted ( otherUser ) ) { if ( outgoing ) { _chatdir . displayFeedback ( null , "m.no_tell_mute" ) ; } return null ; } return msg ; } | documentation inherited from interface ChatFilter |
13,696 | protected void notifyObservers ( final Name username , final boolean muted ) { _observers . apply ( new ObserverList . ObserverOp < MuteObserver > ( ) { public boolean apply ( MuteObserver observer ) { observer . muteChanged ( username , muted ) ; return true ; } } ) ; } | Notify our observers of a change in the mutelist . |
13,697 | public void clearDispatcher ( InvocationMarshaller < ? > marsh ) { _omgr . requireEventThread ( ) ; if ( marsh == null ) { log . warning ( "Refusing to unregister null marshaller." , new Exception ( ) ) ; return ; } if ( _dispatchers . remove ( marsh . getInvocationCode ( ) ) == null ) { log . warning ( "Requested to r... | Clears out a dispatcher registration . This should be called to free up resources when an invocation service is no longer going to be used . |
13,698 | public List < InvocationMarshaller < ? > > getBootstrapServices ( String [ ] bootGroups ) { List < InvocationMarshaller < ? > > services = Lists . newArrayList ( ) ; for ( String group : bootGroups ) { services . addAll ( _bootlists . get ( group ) ) ; } return services ; } | Constructs a list of all bootstrap services registered in any of the supplied groups . |
13,699 | public Class < ? > getDispatcherClass ( int invCode ) { Object dispatcher = _dispatchers . get ( invCode ) ; return ( dispatcher == null ) ? null : dispatcher . getClass ( ) ; } | Get the class that is being used to dispatch the specified invocation code for informational purposes . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.