_id
stringlengths
2
7
title
stringlengths
3
140
partition
stringclasses
3 values
text
stringlengths
73
34.1k
language
stringclasses
1 value
meta_information
dict
q20700
RowIndex.delete
train
@Override public void delete(DecoratedKey key, OpOrder.Group opGroup) { Log.debug("Removing row %s from index %s", key, logName); lock.writeLock().lock(); try { rowService.delete(key); rowService = null; } catch (RuntimeException e) { Log.error(e, ...
java
{ "resource": "" }
q20701
RepairJob.sendTreeRequests
train
public void sendTreeRequests(Collection<InetAddress> endpoints) { // send requests to all nodes List<InetAddress> allEndpoints = new ArrayList<>(endpoints); allEndpoints.add(FBUtilities.getBroadcastAddress()); // Create a snapshot at all nodes unless we're using pure parallel repair...
java
{ "resource": "" }
q20702
RepairJob.addTree
train
public synchronized int addTree(InetAddress endpoint, MerkleTree tree) { // Wait for all request to have been performed (see #3400) try { requestsSent.await(); } catch (InterruptedException e) { throw new AssertionError("Interrupted while waiti...
java
{ "resource": "" }
q20703
AbstractType.getString
train
public String getString(ByteBuffer bytes) { TypeSerializer<T> serializer = getSerializer(); serializer.validate(bytes); return serializer.toString(serializer.deserialize(bytes)); }
java
{ "resource": "" }
q20704
AbstractType.isValueCompatibleWith
train
public boolean isValueCompatibleWith(AbstractType<?> otherType) { return isValueCompatibleWithInternal((otherType instanceof ReversedType) ? ((ReversedType) otherType).baseType : otherType); }
java
{ "resource": "" }
q20705
AbstractType.compareCollectionMembers
train
public int compareCollectionMembers(ByteBuffer v1, ByteBuffer v2, ByteBuffer collectionName) { return compare(v1, v2); }
java
{ "resource": "" }
q20706
SSTableExport.writeKey
train
private static void writeKey(PrintStream out, String value) { writeJSON(out, value); out.print(": "); }
java
{ "resource": "" }
q20707
SSTableExport.serializeColumn
train
private static List<Object> serializeColumn(Cell cell, CFMetaData cfMetaData) { CellNameType comparator = cfMetaData.comparator; ArrayList<Object> serializedColumn = new ArrayList<Object>(); serializedColumn.add(comparator.getString(cell.name())); if (cell instanceof DeletedCell) ...
java
{ "resource": "" }
q20708
SSTableExport.serializeRow
train
private static void serializeRow(SSTableIdentityIterator row, DecoratedKey key, PrintStream out) { serializeRow(row.getColumnFamily().deletionInfo(), row, row.getColumnFamily().metadata(), key, out); }
java
{ "resource": "" }
q20709
SSTableExport.enumeratekeys
train
public static void enumeratekeys(Descriptor desc, PrintStream outs, CFMetaData metadata) throws IOException { KeyIterator iter = new KeyIterator(desc); try { DecoratedKey lastKey = null; while (iter.hasNext()) { DecoratedKey key = iter....
java
{ "resource": "" }
q20710
SSTableExport.export
train
public static void export(Descriptor desc, PrintStream outs, Collection<String> toExport, String[] excludes, CFMetaData metadata) throws IOException { SSTableReader sstable = SSTableReader.open(desc); RandomAccessReader dfile = sstable.openDataReader(); try { IPartitioner...
java
{ "resource": "" }
q20711
SSTableExport.export
train
static void export(SSTableReader reader, PrintStream outs, String[] excludes, CFMetaData metadata) throws IOException { Set<String> excludeSet = new HashSet<String>(); if (excludes != null) excludeSet = new HashSet<String>(Arrays.asList(excludes)); SSTableIdentityIterator row; ...
java
{ "resource": "" }
q20712
SSTableExport.export
train
public static void export(Descriptor desc, PrintStream outs, String[] excludes, CFMetaData metadata) throws IOException { export(SSTableReader.open(desc), outs, excludes, metadata); }
java
{ "resource": "" }
q20713
SSTableExport.export
train
public static void export(Descriptor desc, String[] excludes, CFMetaData metadata) throws IOException { export(desc, System.out, excludes, metadata); }
java
{ "resource": "" }
q20714
SSTableExport.main
train
public static void main(String[] args) throws ConfigurationException { String usage = String.format("Usage: %s <sstable> [-k key [-k key [...]] -x key [-x key [...]]]%n", SSTableExport.class.getName()); CommandLineParser parser = new PosixParser(); try { cmd = parser.par...
java
{ "resource": "" }
q20715
SemanticVersion.findSupportingVersion
train
public SemanticVersion findSupportingVersion(SemanticVersion... versions) { for (SemanticVersion version : versions) { if (isSupportedBy(version)) return version; } return null; }
java
{ "resource": "" }
q20716
IndexSummaryManager.getCompactingAndNonCompactingSSTables
train
private Pair<List<SSTableReader>, Multimap<DataTracker, SSTableReader>> getCompactingAndNonCompactingSSTables() { List<SSTableReader> allCompacting = new ArrayList<>(); Multimap<DataTracker, SSTableReader> allNonCompacting = HashMultimap.create(); for (Keyspace ks : Keyspace.all()) {...
java
{ "resource": "" }
q20717
IndexSummaryManager.redistributeSummaries
train
@VisibleForTesting public static List<SSTableReader> redistributeSummaries(List<SSTableReader> compacting, List<SSTableReader> nonCompacting, long memoryPoolBytes) throws IOException { long total = 0; for (SSTableReader sstable : Iterables.concat(compacting, nonCompacting)) total += ...
java
{ "resource": "" }
q20718
Term.getByteBuffer
train
public ByteBuffer getByteBuffer() throws InvalidRequestException { switch (type) { case STRING: return AsciiType.instance.fromString(text); case INTEGER: return IntegerType.instance.fromString(text); case UUID: // we...
java
{ "resource": "" }
q20719
SEPWorker.selfAssign
train
private boolean selfAssign() { // if we aren't permitted to assign in this state, fail if (!get().canAssign(true)) return false; for (SEPExecutor exec : pool.executors) { if (exec.takeWorkPermit(true)) { Work work = new Work(exec); ...
java
{ "resource": "" }
q20720
SEPWorker.startSpinning
train
private void startSpinning() { assert get() == Work.WORKING; pool.spinningCount.incrementAndGet(); set(Work.SPINNING); }
java
{ "resource": "" }
q20721
SEPWorker.doWaitSpin
train
private void doWaitSpin() { // pick a random sleep interval based on the number of threads spinning, so that // we should always have a thread about to wake up, but most threads are sleeping long sleep = 10000L * pool.spinningCount.get(); sleep = Math.min(1000000, sleep); sle...
java
{ "resource": "" }
q20722
SEPWorker.maybeStop
train
private void maybeStop(long stopCheck, long now) { long delta = now - stopCheck; if (delta <= 0) { // if stopCheck has caught up with present, we've been spinning too much, so if we can atomically // set it to the past again, we should stop a worker if (po...
java
{ "resource": "" }
q20723
SecondaryIndexSearcher.postReconciliationProcessing
train
public List<Row> postReconciliationProcessing(List<IndexExpression> clause, List<Row> rows) { return rows; }
java
{ "resource": "" }
q20724
SecondaryIndex.isIndexBuilt
train
public boolean isIndexBuilt(ByteBuffer columnName) { return SystemKeyspace.isIndexBuilt(baseCfs.keyspace.getName(), getNameForSystemKeyspace(columnName)); }
java
{ "resource": "" }
q20725
SecondaryIndex.buildIndexBlocking
train
protected void buildIndexBlocking() { logger.info(String.format("Submitting index build of %s for data in %s", getIndexName(), StringUtils.join(baseCfs.getSSTables(), ", "))); try (Refs<SSTableReader> sstables = baseCfs.selectAndReference(ColumnFamilyStore.CANONICAL_SSTABLES).refs) ...
java
{ "resource": "" }
q20726
SecondaryIndex.buildIndexAsync
train
public Future<?> buildIndexAsync() { // if we're just linking in the index to indexedColumns on an already-built index post-restart, we're done boolean allAreBuilt = true; for (ColumnDefinition cdef : columnDefs) { if (!SystemKeyspace.isIndexBuilt(baseCfs.keyspace.getName...
java
{ "resource": "" }
q20727
SecondaryIndex.getIndexKeyFor
train
public DecoratedKey getIndexKeyFor(ByteBuffer value) { // FIXME: this imply one column definition per index ByteBuffer name = columnDefs.iterator().next().name.bytes; return new BufferDecoratedKey(new LocalToken(baseCfs.metadata.getColumnDefinition(name).type, value), value); }
java
{ "resource": "" }
q20728
SecondaryIndex.createInstance
train
public static SecondaryIndex createInstance(ColumnFamilyStore baseCfs, ColumnDefinition cdef) throws ConfigurationException { SecondaryIndex index; switch (cdef.getIndexType()) { case KEYS: index = new KeysIndex(); break; case COMPOSITES: ...
java
{ "resource": "" }
q20729
SecondaryIndex.getIndexComparator
train
public static CellNameType getIndexComparator(CFMetaData baseMetadata, ColumnDefinition cdef) { switch (cdef.getIndexType()) { case KEYS: return new SimpleDenseCellNameType(keyComparator); case COMPOSITES: return CompositesIndex.getIndexCompara...
java
{ "resource": "" }
q20730
ActiveRepairService.submitRepairSession
train
public RepairFuture submitRepairSession(UUID parentRepairSession, Range<Token> range, String keyspace, RepairParallelism parallelismDegree, Set<InetAddress> endpoints, String... cfnames) { if (cfnames.length == 0) return null; RepairSession session = new RepairSession(parentRepairSession...
java
{ "resource": "" }
q20731
ActiveRepairService.getNeighbors
train
public static Set<InetAddress> getNeighbors(String keyspaceName, Range<Token> toRepair, Collection<String> dataCenters, Collection<String> hosts) { StorageService ss = StorageService.instance; Map<Range<Token>, List<InetAddress>> replicaSets = ss.getRangeToAddressMap(keyspaceName); Range<Tok...
java
{ "resource": "" }
q20732
CBUtil.decodeString
train
private static String decodeString(ByteBuffer src) throws CharacterCodingException { // the decoder needs to be reset every time we use it, hence the copy per thread CharsetDecoder theDecoder = decoder.get(); theDecoder.reset(); final CharBuffer dst = CharBuffer.allocate( ...
java
{ "resource": "" }
q20733
CassandraDaemon.activate
train
public void activate() { String pidFile = System.getProperty("cassandra-pidfile"); try { try { MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); mbs.registerMBean(new StandardMBean(new NativeAccess(), NativeAccessMBean.clas...
java
{ "resource": "" }
q20734
KeyspaceElementName.toInternalName
train
protected static String toInternalName(String name, boolean keepCase) { return keepCase ? name : name.toLowerCase(Locale.US); }
java
{ "resource": "" }
q20735
DynamicList.append
train
public Node<E> append(E value, int maxSize) { Node<E> newTail = new Node<>(randomLevel(), value); lock.writeLock().lock(); try { if (size >= maxSize) return null; size++; Node<E> tail = head; for (int i = maxHeight - 1...
java
{ "resource": "" }
q20736
DynamicList.remove
train
public void remove(Node<E> node) { lock.writeLock().lock(); assert node.value != null; node.value = null; try { size--; // go up through each level in the skip list, unlinking this node; this entails // simply linking each neighbour to eac...
java
{ "resource": "" }
q20737
DynamicList.get
train
public E get(int index) { lock.readLock().lock(); try { if (index >= size) return null; index++; int c = 0; Node<E> finger = head; for (int i = maxHeight - 1 ; i >= 0 ; i--) { while (c + ...
java
{ "resource": "" }
q20738
DynamicList.isWellFormed
train
private boolean isWellFormed() { for (int i = 0 ; i < maxHeight ; i++) { int c = 0; for (Node node = head ; node != null ; node = node.next(i)) { if (node.prev(i) != null && node.prev(i).next(i) != node) return false; ...
java
{ "resource": "" }
q20739
IndexSummary.binarySearch
train
public int binarySearch(RowPosition key) { int low = 0, mid = offsetCount, high = mid - 1, result = -1; while (low <= high) { mid = (low + high) >> 1; result = -DecoratedKey.compareTo(partitioner, ByteBuffer.wrap(getKey(mid)), key); if (result > 0) ...
java
{ "resource": "" }
q20740
TriggerExecutor.reloadClasses
train
public void reloadClasses() { File triggerDirectory = FBUtilities.cassandraTriggerDir(); if (triggerDirectory == null) return; customClassLoader = new CustomClassLoader(parent, triggerDirectory); cachedTriggers.clear(); }
java
{ "resource": "" }
q20741
TriggerExecutor.executeInternal
train
private List<Mutation> executeInternal(ByteBuffer key, ColumnFamily columnFamily) { Map<String, TriggerDefinition> triggers = columnFamily.metadata().getTriggers(); if (triggers.isEmpty()) return null; List<Mutation> tmutations = Lists.newLinkedList(); Thread.currentThrea...
java
{ "resource": "" }
q20742
SnowballAnalyzerBuilder.getDefaultStopwords
train
private static CharArraySet getDefaultStopwords(String language) { switch (language) { case "English": return EnglishAnalyzer.getDefaultStopSet(); case "French": return FrenchAnalyzer.getDefaultStopSet(); case "Spanish": return ...
java
{ "resource": "" }
q20743
CqlConfigHelper.setInputColumns
train
public static void setInputColumns(Configuration conf, String columns) { if (columns == null || columns.isEmpty()) return; conf.set(INPUT_CQL_COLUMNS_CONFIG, columns); }
java
{ "resource": "" }
q20744
CqlConfigHelper.setInputCQLPageRowSize
train
public static void setInputCQLPageRowSize(Configuration conf, String cqlPageRowSize) { if (cqlPageRowSize == null) { throw new UnsupportedOperationException("cql page row size may not be null"); } conf.set(INPUT_CQL_PAGE_ROW_SIZE_CONFIG, cqlPageRowSize); }
java
{ "resource": "" }
q20745
CqlConfigHelper.setInputWhereClauses
train
public static void setInputWhereClauses(Configuration conf, String clauses) { if (clauses == null || clauses.isEmpty()) return; conf.set(INPUT_CQL_WHERE_CLAUSE_CONFIG, clauses); }
java
{ "resource": "" }
q20746
CqlConfigHelper.setOutputCql
train
public static void setOutputCql(Configuration conf, String cql) { if (cql == null || cql.isEmpty()) return; conf.set(OUTPUT_CQL, cql); }
java
{ "resource": "" }
q20747
ClientState.getTimestamp
train
public long getTimestamp() { while (true) { long current = System.currentTimeMillis() * 1000; long last = lastTimestampMicros.get(); long tstamp = last >= current ? last + 1 : current; if (lastTimestampMicros.compareAndSet(last, tstamp)) ...
java
{ "resource": "" }
q20748
ClientState.login
train
public void login(AuthenticatedUser user) throws AuthenticationException { if (!user.isAnonymous() && !Auth.isExistingUser(user.getName())) throw new AuthenticationException(String.format("User %s doesn't exist - create it with CREATE USER query first", ...
java
{ "resource": "" }
q20749
OmemoManager.getOwnDevice
train
public OmemoDevice getOwnDevice() { synchronized (LOCK) { BareJid jid = getOwnJid(); if (jid == null) { return null; } return new OmemoDevice(jid, getDeviceId()); } }
java
{ "resource": "" }
q20750
OmemoManager.setDeviceId
train
void setDeviceId(int nDeviceId) { synchronized (LOCK) { // Move this instance inside the HashMaps INSTANCES.get(connection()).remove(getDeviceId()); INSTANCES.get(connection()).put(nDeviceId, this); this.deviceId = nDeviceId; } }
java
{ "resource": "" }
q20751
OmemoManager.notifyOmemoMessageReceived
train
void notifyOmemoMessageReceived(Stanza stanza, OmemoMessage.Received decryptedMessage) { for (OmemoMessageListener l : omemoMessageListeners) { l.onOmemoMessageReceived(stanza, decryptedMessage); } }
java
{ "resource": "" }
q20752
OmemoManager.notifyOmemoMucMessageReceived
train
void notifyOmemoMucMessageReceived(MultiUserChat muc, Stanza stanza, OmemoMessage.Received decryptedMessage) { for (OmemoMucMessageListener l : omemoMucMessageListeners) { l.onOmemoMucMessageReceived(muc, stanza, decrypted...
java
{ "resource": "" }
q20753
OmemoManager.stopStanzaAndPEPListeners
train
public void stopStanzaAndPEPListeners() { PepManager.getInstanceFor(connection()).removePepListener(deviceListUpdateListener); connection().removeAsyncStanzaListener(internalOmemoMessageStanzaListener); CarbonManager.getInstanceFor(connection()).removeCarbonCopyReceivedListener(internalOmemoCarb...
java
{ "resource": "" }
q20754
OmemoManager.rebuildSessionWith
train
public void rebuildSessionWith(OmemoDevice contactsDevice) throws InterruptedException, SmackException.NoResponseException, CorruptedOmemoKeyException, SmackException.NotConnectedException, CannotEstablishOmemoSessionException, SmackException.NotLoggedInException { if (!conne...
java
{ "resource": "" }
q20755
OmemoManager.initBareJidAndDeviceId
train
private static void initBareJidAndDeviceId(OmemoManager manager) { if (!manager.getConnection().isAuthenticated()) { throw new IllegalStateException("Connection MUST be authenticated."); } if (manager.ownJid == null) { manager.ownJid = manager.getConnection().getUser().a...
java
{ "resource": "" }
q20756
EnhancedDebuggerWindow.showNewDebugger
train
private void showNewDebugger(EnhancedDebugger debugger) { if (frame == null) { createDebug(); } debugger.tabbedPane.setName("XMPPConnection_" + tabbedPane.getComponentCount()); tabbedPane.add(debugger.tabbedPane, tabbedPane.getComponentCount() - 1); tabbedPane.setIcon...
java
{ "resource": "" }
q20757
EnhancedDebuggerWindow.userHasLogged
train
static synchronized void userHasLogged(EnhancedDebugger debugger, String user) { int index = getInstance().tabbedPane.indexOfComponent(debugger.tabbedPane); getInstance().tabbedPane.setTitleAt( index, user); getInstance().tabbedPane.setIconAt( inde...
java
{ "resource": "" }
q20758
EnhancedDebuggerWindow.connectionClosed
train
static synchronized void connectionClosed(EnhancedDebugger debugger) { getInstance().tabbedPane.setIconAt( getInstance().tabbedPane.indexOfComponent(debugger.tabbedPane), connectionClosedIcon); }
java
{ "resource": "" }
q20759
EnhancedDebuggerWindow.connectionClosedOnError
train
static synchronized void connectionClosedOnError(EnhancedDebugger debugger, Exception e) { int index = getInstance().tabbedPane.indexOfComponent(debugger.tabbedPane); getInstance().tabbedPane.setToolTipTextAt( index, "XMPPConnection closed due to the exception: " + e.getM...
java
{ "resource": "" }
q20760
EnhancedDebuggerWindow.rootWindowClosing
train
private synchronized void rootWindowClosing(WindowEvent evt) { // Notify to all the debuggers to stop debugging for (EnhancedDebugger debugger : debuggers) { debugger.cancel(); } // Release any reference to the debuggers debuggers.clear(); // Release the defau...
java
{ "resource": "" }
q20761
MucConfigFormManager.setRoomOwners
train
public MucConfigFormManager setRoomOwners(Collection<? extends Jid> newOwners) throws MucConfigurationNotSupportedException { if (!supportsRoomOwners()) { throw new MucConfigurationNotSupportedException(MUC_ROOMCONFIG_ROOMOWNERS); } owners.clear(); owners.addAll(newOwners); ...
java
{ "resource": "" }
q20762
MucConfigFormManager.setMembersOnly
train
public MucConfigFormManager setMembersOnly(boolean isMembersOnly) throws MucConfigurationNotSupportedException { if (!supportsMembersOnly()) { throw new MucConfigurationNotSupportedException(MUC_ROOMCONFIG_MEMBERSONLY); } answerForm.setAnswer(MUC_ROOMCONFIG_MEMBERSONLY, isMembersOnly...
java
{ "resource": "" }
q20763
MucConfigFormManager.setIsPasswordProtected
train
public MucConfigFormManager setIsPasswordProtected(boolean isPasswordProtected) throws MucConfigurationNotSupportedException { if (!supportsMembersOnly()) { throw new MucConfigurationNotSupportedException(MUC_ROOMCONFIG_PASSWORDPROTECTEDROOM); } answerForm.setAnsw...
java
{ "resource": "" }
q20764
STUN.getSTUNServer
train
@SuppressWarnings("deprecation") public static STUN getSTUNServer(XMPPConnection connection) throws NotConnectedException, InterruptedException { if (!connection.isConnected()) { return null; } STUN stunPacket = new STUN(); stunPacket.setTo(DOMAIN + "." + connection.get...
java
{ "resource": "" }
q20765
STUN.serviceAvailable
train
public static boolean serviceAvailable(XMPPConnection connection) throws XMPPException, SmackException, InterruptedException { if (!connection.isConnected()) { return false; } LOGGER.fine("Service listing"); ServiceDiscoveryManager disco = ServiceDiscoveryManager.getInstan...
java
{ "resource": "" }
q20766
AudioMediaSession.getFreePort
train
protected int getFreePort() { ServerSocket ss; int freePort = 0; for (int i = 0; i < 10; i++) { freePort = (int) (10000 + Math.round(Math.random() * 10000)); freePort = freePort % 2 == 0 ? freePort : freePort + 1; try { ss = new ServerSocket(f...
java
{ "resource": "" }
q20767
VCard.setField
train
public void setField(String field, String value, boolean isUnescapable) { if (!isUnescapable) { otherSimpleFields.put(field, value); } else { otherUnescapableFields.put(field, value); } }
java
{ "resource": "" }
q20768
VCard.setAvatar
train
public void setAvatar(URL avatarURL) { byte[] bytes = new byte[0]; try { bytes = getBytes(avatarURL); } catch (IOException e) { LOGGER.log(Level.SEVERE, "Error getting bytes from URL: " + avatarURL, e); } setAvatar(bytes); }
java
{ "resource": "" }
q20769
VCard.setAvatar
train
public void setAvatar(byte[] bytes, String mimeType) { // If bytes is null, remove the avatar if (bytes == null) { removeAvatar(); return; } // Otherwise, add to mappings. String encodedImage = Base64.encodeToString(bytes); setAvatar(encodedImage...
java
{ "resource": "" }
q20770
VCard.getBytes
train
public static byte[] getBytes(URL url) throws IOException { final String path = url.getPath(); final File file = new File(path); if (file.exists()) { return getFileBytes(file); } return null; }
java
{ "resource": "" }
q20771
VCard.getAvatarHash
train
public String getAvatarHash() { byte[] bytes = getAvatar(); if (bytes == null) { return null; } MessageDigest digest; try { digest = MessageDigest.getInstance("SHA-1"); } catch (NoSuchAlgorithmException e) { LOGGER.log(Level.SE...
java
{ "resource": "" }
q20772
VCard.load
train
@Deprecated public void load(XMPPConnection connection) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { load(connection, null); }
java
{ "resource": "" }
q20773
VCard.load
train
@Deprecated public void load(XMPPConnection connection, EntityBareJid user) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { VCard result = VCardManager.getInstanceFor(connection).loadVCard(user); copyFieldsFrom(result); }
java
{ "resource": "" }
q20774
OpenPgpContact.updateKeys
train
public void updateKeys(XMPPConnection connection) throws InterruptedException, SmackException.NotConnectedException, SmackException.NoResponseException, XMPPException.XMPPErrorException, PubSubException.NotALeafNodeException, PubSubException.NotAPubSubNodeException, IOException { PublicK...
java
{ "resource": "" }
q20775
JmfMediaManager.setupPayloads
train
private void setupPayloads() { payloads.add(new PayloadType.Audio(3, "gsm")); payloads.add(new PayloadType.Audio(4, "g723")); payloads.add(new PayloadType.Audio(0, "PCMU", 16000)); }
java
{ "resource": "" }
q20776
JmfMediaManager.setupJMF
train
public static void setupJMF() { // .jmf is the place where we store the jmf.properties file used // by JMF. if the directory does not exist or it does not contain // a jmf.properties file. or if the jmf.properties file has 0 length // then this is the first time we're running and should ...
java
{ "resource": "" }
q20777
SubscribeForm.setDeliverOn
train
public void setDeliverOn(boolean deliverNotifications) { addField(SubscribeOptionFields.deliver, FormField.Type.bool); setAnswer(SubscribeOptionFields.deliver.getFieldName(), deliverNotifications); }
java
{ "resource": "" }
q20778
SubscribeForm.setDigestOn
train
public void setDigestOn(boolean digestOn) { addField(SubscribeOptionFields.deliver, FormField.Type.bool); setAnswer(SubscribeOptionFields.deliver.getFieldName(), digestOn); }
java
{ "resource": "" }
q20779
SubscribeForm.setDigestFrequency
train
public void setDigestFrequency(int frequency) { addField(SubscribeOptionFields.digest_frequency, FormField.Type.text_single); setAnswer(SubscribeOptionFields.digest_frequency.getFieldName(), frequency); }
java
{ "resource": "" }
q20780
SubscribeForm.getExpiry
train
public Date getExpiry() { String dateTime = getFieldValue(SubscribeOptionFields.expire); try { return XmppDateTime.parseDate(dateTime); } catch (ParseException e) { UnknownFormatConversionException exc = new UnknownFormatConversionException(dateTime); ...
java
{ "resource": "" }
q20781
SubscribeForm.setExpiry
train
public void setExpiry(Date expire) { addField(SubscribeOptionFields.expire, FormField.Type.text_single); setAnswer(SubscribeOptionFields.expire.getFieldName(), XmppDateTime.formatXEP0082Date(expire)); }
java
{ "resource": "" }
q20782
SubscribeForm.setIncludeBody
train
public void setIncludeBody(boolean include) { addField(SubscribeOptionFields.include_body, FormField.Type.bool); setAnswer(SubscribeOptionFields.include_body.getFieldName(), include); }
java
{ "resource": "" }
q20783
AgentRoster.addListener
train
public void addListener(AgentRosterListener listener) { synchronized (listeners) { if (!listeners.contains(listener)) { listeners.add(listener); // Fire events for the existing entries and presences in the roster for (EntityBareJid jid : getAgents()) ...
java
{ "resource": "" }
q20784
AgentRoster.contains
train
public boolean contains(Jid jid) { if (jid == null) { return false; } synchronized (entries) { for (Iterator<EntityBareJid> i = entries.iterator(); i.hasNext();) { EntityBareJid entry = i.next(); if (entry.equals(jid)) { ...
java
{ "resource": "" }
q20785
AgentRoster.fireEvent
train
private void fireEvent(int eventType, Object eventObject) { AgentRosterListener[] listeners; synchronized (this.listeners) { listeners = new AgentRosterListener[this.listeners.size()]; this.listeners.toArray(listeners); } for (int i = 0; i < listeners.length; i++)...
java
{ "resource": "" }
q20786
JingleError.toXML
train
@Override public String toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { StringBuilder buf = new StringBuilder(); if (message != null) { buf.append("<error type=\"cancel\">"); buf.append('<').append(message).append(" xmlns=\"").append(NAMESPACE).append...
java
{ "resource": "" }
q20787
Workgroup.isAvailable
train
public boolean isAvailable() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { Presence directedPresence = new Presence(Presence.Type.available); directedPresence.setTo(workgroupJID); StanzaFilter typeFilter = new StanzaTypeFilter(Presence.class); ...
java
{ "resource": "" }
q20788
Workgroup.getChatSetting
train
public ChatSetting getChatSetting(String key) throws XMPPException, SmackException, InterruptedException { ChatSettings chatSettings = getChatSettings(key, -1); return chatSettings.getFirstEntry(); }
java
{ "resource": "" }
q20789
Workgroup.getChatSettings
train
private ChatSettings getChatSettings(String key, int type) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { ChatSettings request = new ChatSettings(); if (key != null) { request.setKey(key); } if (type != -1) { request....
java
{ "resource": "" }
q20790
Workgroup.isEmailAvailable
train
public boolean isEmailAvailable() throws SmackException, InterruptedException { ServiceDiscoveryManager discoManager = ServiceDiscoveryManager.getInstanceFor(connection); try { DomainBareJid workgroupService = workgroupJID.asDomainBareJid(); DiscoverInfo infoResult = discoManage...
java
{ "resource": "" }
q20791
Workgroup.getOfflineSettings
train
public OfflineSettings getOfflineSettings() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { OfflineSettings request = new OfflineSettings(); request.setType(IQ.Type.get); request.setTo(workgroupJID); return connection.createStanzaCollectorAn...
java
{ "resource": "" }
q20792
Workgroup.getSoundSettings
train
public SoundSettings getSoundSettings() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { SoundSettings request = new SoundSettings(); request.setType(IQ.Type.get); request.setTo(workgroupJID); return connection.createStanzaCollectorAndSend(re...
java
{ "resource": "" }
q20793
Workgroup.getWorkgroupProperties
train
public WorkgroupProperties getWorkgroupProperties() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { WorkgroupProperties request = new WorkgroupProperties(); request.setType(IQ.Type.get); request.setTo(workgroupJID); return connection.create...
java
{ "resource": "" }
q20794
RosterExchange.addRosterEntry
train
public void addRosterEntry(RosterEntry rosterEntry) { // Obtain a String[] from the roster entry groups name List<String> groupNamesList = new ArrayList<>(); String[] groupNames; for (RosterGroup group : rosterEntry.getGroups()) { groupNamesList.add(group.getName()); ...
java
{ "resource": "" }
q20795
RosterExchange.getRosterEntries
train
public Iterator<RemoteRosterEntry> getRosterEntries() { synchronized (remoteRosterEntries) { List<RemoteRosterEntry> entries = Collections.unmodifiableList(new ArrayList<>(remoteRosterEntries)); return entries.iterator(); } }
java
{ "resource": "" }
q20796
RosterExchange.toXML
train
@Override public String toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { StringBuilder buf = new StringBuilder(); buf.append('<').append(getElementName()).append(" xmlns=\"").append(getNamespace()).append( "\">"); // Loop through all roster entries and app...
java
{ "resource": "" }
q20797
SpeexMediaManager.createMediaSession
train
@Override public JingleMediaSession createMediaSession(PayloadType payloadType, final TransportCandidate remote, final TransportCandidate local, final JingleSession jingleSession) { return new AudioMediaSession(payloadType, remote, local, null,null); }
java
{ "resource": "" }
q20798
Objects.requireNonNullNorEmpty
train
public static <T extends Collection<?>> T requireNonNullNorEmpty(T collection, String message) { if (requireNonNull(collection).isEmpty()) { throw new IllegalArgumentException(message); } return collection; }
java
{ "resource": "" }
q20799
BridgedResolver.resolve
train
@Override public synchronized void resolve(JingleSession session) throws XMPPException, NotConnectedException, InterruptedException { setResolveInit(); clearCandidates(); sid = random.nextInt(Integer.MAX_VALUE); RTPBridge rtpBridge = RTPBridge.getRTPBridge(connection, String.valu...
java
{ "resource": "" }