MediaConstraints pcConstraints = signalingParameters.pcConstraints; // pcConstraints.optional.add(new KeyValuePair("RtpDataChannels", "false")); pcConstraints.optional.add(new KeyValuePair("DtlsSrtpKeyAgreement", "true")); pc = factory.createPeerConnection(signalingParameters.iceServers, pcConstraints, pcObserver);
pcConstraints.optional.add(new KeyValuePair("DtlsSrtpKeyAgreement", "true")); pcConstraints.optional.add(new KeyValuePair("RtpDataChannels", "true"));
choiceBox .getItems().add(new KeyValuePair("1", "Active"));
List<KeyValuePair> data = new ArrayList<>(); data.add(new KeyValuePair("field1", "123")); data.add(new KeyValuePair("field2", "XYX"));
static KeyValuePair<String, Boolean> readElement(ByteBuf buffer, StringBuilder sb) { for (; ; ) { byte next = buffer.readByte(); if (next == SP) { // Space return new KeyValuePair<>(sb.toString().trim(), false); } else if (next == CR) { // CR next = buffer.readByte(); if (next == LF) { // LF return new KeyValuePair<>(sb.toString().trim(), true); } else { sb.append(next); } } else { sb.append(next); } } }
final KeyValuePair kvHungry = new KeyValuePair("hunger", "Y"); boolean hungry = false; for (KeyValuePair pair : pairs) hungry |= pair.equals(kvHungry);
private KeyValuePair<HotRodOperation, Boolean> getEventResponseType(CacheEntryEvent event) { switch (event.getType()) { case CACHE_ENTRY_CREATED: return new KeyValuePair<>(HotRodOperation.CACHE_ENTRY_CREATED_EVENT, ((CacheEntryCreatedEvent) event).isCommandRetried()); case CACHE_ENTRY_MODIFIED: return new KeyValuePair<>(HotRodOperation.CACHE_ENTRY_MODIFIED_EVENT, ((CacheEntryModifiedEvent) event).isCommandRetried()); case CACHE_ENTRY_REMOVED: return new KeyValuePair<>(HotRodOperation.CACHE_ENTRY_REMOVED_EVENT, ((CacheEntryRemovedEvent) event).isCommandRetried()); case CACHE_ENTRY_EXPIRED: return new KeyValuePair<>(HotRodOperation.CACHE_ENTRY_EXPIRED_EVENT, false); default: throw log.unexpectedEvent(event); } } }
private KeyValuePair<byte[], Boolean> readKey(ByteBuf b) throws IOException { boolean endOfOp = readElement(b, byteBuffer); byte[] keyBytes = byteBuffer.toByteArray(); byte[] k = checkKeyLength(keyBytes, endOfOp, b); return new KeyValuePair<>(k, endOfOp); }
private KeyValuePair<KeyValueFilterConverter, Boolean> buildFilter(KeyValueFilterConverterFactory factory, byte[][] params, Function<Object, Object> unmarshallParam) { if (factory instanceof ParamKeyValueFilterConverterFactory) { ParamKeyValueFilterConverterFactory paramFactory = (ParamKeyValueFilterConverterFactory) factory; Object[] unmarshallParams; if (paramFactory.binaryParam()) { unmarshallParams = params; } else { unmarshallParams = Arrays.stream(params).map(unmarshallParam).toArray(); } return new KeyValuePair<>(paramFactory.getFilterConverter(unmarshallParams), paramFactory.binaryParam()); } else { return new KeyValuePair<>(factory.getFilterConverter(), false); } }
public static KeyValuePair<TimeUnitValue, TimeUnitValue> decodePair(byte timeUnitValues) { return new KeyValuePair<>(decode((byte) ((timeUnitValues & 0xf0) >> 4)), decode((byte) (timeUnitValues & 0x0f))); } }
void put(Class<?> clazz, Boolean value) { if (indexedEntities != null) { throw new IllegalStateException("Autodetect mode is not enabled for cache " + cacheName); } if (value == null) { throw new IllegalArgumentException("Null values are not allowed"); } startInternalCache(); Transaction tx = transactionHelper.suspendTxIfExists(); try { knownClassesCache.put(new KeyValuePair<>(cacheName, clazz), value); } finally { transactionHelper.resume(tx); } localCacheInsert(clazz, value); }
protected KeyValuePair<String, Session> readEvent(ClientCacheEntryCustomEvent<byte[]> event) { byte[] eventData = event.getEventData(); ByteBuffer rawData = ByteBuffer.wrap(eventData); byte[] rawKey = readElement(rawData); byte[] rawValue = readElement(rawData); String key = dataFormat.keyToObj(rawKey, whitelist); KeyValuePair keyValuePair; if (rawValue == null) { // This events will hold either an old or a new value almost every time. But there are some corner cases // during rebalance where neither a new or an old value will be present. This if handles this case keyValuePair = new KeyValuePair<>(key, new MapSession(key)); } else { keyValuePair = new KeyValuePair<>(key, dataFormat.valueToObj(rawValue, whitelist)); } return keyValuePair; }
void put(final Class<?> clazz, final Boolean value) { if (indexedEntities != null) { throw new IllegalStateException("Autodetect mode is not enabled"); } if (value == null) { throw new IllegalArgumentException("Null values are not allowed"); } startInternalCache(); Transaction tx = transactionHelper.suspendTxIfExists(); try { runCommand(() -> knownClassesCache.put(new KeyValuePair<>(cacheName, clazz), value)); } finally { transactionHelper.resume(tx); } localCacheInsert(clazz, value); }
private Map<String, KeyValuePair<AdvancedAsyncCacheLoader, AdvancedAsyncCacheWriter>> createAsyncStores() throws PersistenceException { Map<String, KeyValuePair<AdvancedAsyncCacheLoader, AdvancedAsyncCacheWriter>> stores = new TreeMap<String, KeyValuePair<AdvancedAsyncCacheLoader, AdvancedAsyncCacheWriter>>(); AdvancedAsyncCacheWriter writer = createAsyncStore(); AdvancedAsyncCacheLoader loader = new AdvancedAsyncCacheLoader((CacheLoader) writer.undelegate(), writer.getState()); KeyValuePair<AdvancedAsyncCacheLoader, AdvancedAsyncCacheWriter> pair = new KeyValuePair<AdvancedAsyncCacheLoader, AdvancedAsyncCacheWriter>(loader, writer); stores.put("ASYNC", pair); return stores; }
public void testConvertedEventsNoReplay(Method m) { EventLogListener eventListener = new EventLogListener(); byte[] key = new byte[]{1}; byte[] value = new byte[]{2}; client().put(key, 0, 0, value); withClientListener(client(), eventListener, Optional.empty(), Optional.of(new KeyValuePair<>("static-converter-factory", Collections.emptyList())), () -> { eventListener.expectNoEvents(Optional.empty()); }); }
private byte[] serialize(MarshalledEntry o) { try { return marshaller.objectToByteBuffer(new KeyValuePair(o.getValue(), o.getMetadata())); } catch (IOException e) { throw new CacheException(e); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new CacheException(e); } }
private void prepareStatement(MarshalledEntry entry, String key, int segment, PreparedStatement ps, boolean upsert) throws InterruptedException, SQLException { ByteBuffer byteBuffer = marshall(new KeyValuePair(entry.getValueBytes(), entry.getMetadataBytes())); long expiryTime = getExpiryTime(entry.getMetadata()); if (upsert) { tableManager.prepareUpsertStatement(ps, key, expiryTime, segment, byteBuffer); } else { tableManager.prepareUpdateStatement(ps, key, expiryTime, segment, byteBuffer); } }
public void testConvertedEventsReplay(Method m) { EventLogListener eventListener = new EventLogListener(); byte[] key = new byte[]{1}; byte[] value = new byte[]{2}; client().put(key, 0, 0, value); withClientListener(client(), eventListener, Optional.empty(), Optional .of(new KeyValuePair<>("static-converter-factory", Collections.emptyList())), true, true, () -> { eventListener.expectSingleCustomEvent(cache, addLengthPrefix(key, value)); }); }
public void testFilteringInCluster(Method m) { HotRodClient client1 = clients().get(0); HotRodClient client2 = clients().get(1); EventLogListener listener1 = new EventLogListener(); Optional<KeyValuePair<String, List<byte[]>>> filterFactory = Optional.of(new KeyValuePair<String, List<byte[]>>("accepted-key-filter-factory", Collections.emptyList())); byte[] key1 = k(m, "k1-"); withClusterClientListener(client1, listener1, filterFactory, Optional.empty(), Optional.of(key1), false, () -> { client2.put(k(m, "k-99"), 0, 0, v(m)); listener1.expectNoEvents(Optional.empty()); client2.remove(k(m, "k-99")); listener1.expectNoEvents(Optional.empty()); client2.put(key1, 0, 0, v(m)); listener1.expectOnlyCreatedEvent(anyCache(), key1); client1.remove(key1); listener1.expectOnlyRemovedEvent(anyCache(), key1); }); }
public void testCustomEvents(Method m) { EventLogListener eventListener = new EventLogListener(); withClientListener(client(), eventListener, Optional.empty(), Optional.of(new KeyValuePair<>("static-converter-factory", Collections.emptyList())), () -> { eventListener.expectNoEvents(Optional.empty()); byte[] key = k(m); client().remove(key); eventListener.expectNoEvents(Optional.empty()); byte[] value = v(m); client().put(key, 0, 0, value); eventListener.expectSingleCustomEvent(cache, addLengthPrefix(key, value)); byte[] value2 = v(m, "v2-"); client().put(key, 0, 0, value2); eventListener.expectSingleCustomEvent(cache, addLengthPrefix(key, value2)); client().remove(key); eventListener.expectSingleCustomEvent(cache, addLengthPrefix(key)); }); }