gpt4 book ai didi

org.infinispan.commons.marshall.WrappedByteArray.getBytes()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-26 21:37:05 25 4
gpt4 key购买 nike

本文整理了Java中org.infinispan.commons.marshall.WrappedByteArray.getBytes()方法的一些代码示例,展示了WrappedByteArray.getBytes()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WrappedByteArray.getBytes()方法的具体详情如下:
包路径:org.infinispan.commons.marshall.WrappedByteArray
类名称:WrappedByteArray
方法名:getBytes

WrappedByteArray.getBytes介绍

暂无

代码示例

代码示例来源:origin: wildfly/wildfly

private byte[] marshall(Object key) {
  try {
    return (key instanceof WrappedByteArray) ? ((WrappedByteArray) key).getBytes() : this.ctx.getMarshaller().objectToByteBuffer(key);
  } catch (IOException | InterruptedException e) {
    throw new PersistenceException(e);
  }
}

代码示例来源:origin: org.infinispan/infinispan-commons

@Override
public Object unwrap(Object obj) {
 if (obj != null && obj.getClass().equals(WrappedByteArray.class))
   return WrappedByteArray.class.cast(obj).getBytes();
 return obj;
}

代码示例来源:origin: org.infinispan/infinispan-query

@Override
protected <K, V> void matchEvent(EventWrapper<K, V, CacheEntryEvent<K, V>> eventWrapper, Matcher matcher) {
 CacheEntryEvent<?, ?> event = eventWrapper.getEvent();
 Object instance = event.getValue();
 if (instance != null) {
   if (instance.getClass() == WrappedByteArray.class) {
    instance = ((WrappedByteArray) instance).getBytes();
   }
   matcher.match(eventWrapper, event.getType(), instance);
 }
}

代码示例来源:origin: org.infinispan/infinispan-embedded-query

@Override
protected <K, V> void matchEvent(EventWrapper<K, V, CacheEntryEvent<K, V>> eventWrapper, Matcher matcher) {
 CacheEntryEvent<?, ?> event = eventWrapper.getEvent();
 Object instance = event.getValue();
 if (instance != null) {
   if (instance.getClass() == WrappedByteArray.class) {
    instance = ((WrappedByteArray) instance).getBytes();
   }
   matcher.match(eventWrapper, event.getType(), instance);
 }
}

代码示例来源:origin: org.wildfly/wildfly-clustering-infinispan-extension

private byte[] marshall(Object key) {
  try {
    return (key instanceof WrappedByteArray) ? ((WrappedByteArray) key).getBytes() : this.ctx.getMarshaller().objectToByteBuffer(key);
  } catch (IOException | InterruptedException e) {
    throw new PersistenceException(e);
  }
}

代码示例来源:origin: org.infinispan/infinispan-server-hotrod

private static TxWrite transform(Map.Entry<WrappedByteArray, ContextValue> entry) {
 ContextValue contextValue = entry.getValue();
 if (contextValue.removed) {
   return TxWrite.remove(entry.getKey().getBytes(), ControlByte.REMOVE_OP.set(contextValue.control),
      contextValue.versionRead);
 } else {
   return TxWrite.put(entry.getKey().getBytes(), contextValue.value, contextValue.lifespan, contextValue.maxIdle,
      contextValue.control, contextValue.versionRead);
 }
}

代码示例来源:origin: org.infinispan/infinispan-commons

@Override
public int hash(Object o) {
 if (o instanceof byte[])
   return hash((byte[]) o);
 else if (o instanceof WrappedByteArray) {
   return hash(((WrappedByteArray) o).getBytes());
 }
 else if (o instanceof long[])
   return hash((long[]) o);
 else if (o instanceof String)
   return hashString((String) o);
 else
   return hash(o.hashCode());
}

代码示例来源:origin: org.infinispan/infinispan-server-hotrod

private ClientNotificationManager add(WrappedByteArray id, ClientNotificationManager manager, byte version,
                   String counterName, Channel channel, VersionedEncoder encoder, ByRef<ListenerOperationStatus> status) {
 boolean useChannel = false;
 if (manager == null) {
   manager = new ClientNotificationManager(id.getBytes(), counterManager, channel, encoder);
   useChannel = true;
 }
 if (manager.addCounterListener(version, counterName)) {
   status.set(useChannel ? ListenerOperationStatus.OK_AND_CHANNEL_IN_USE : ListenerOperationStatus.OK);
   return manager;
 } else {
   status.set(ListenerOperationStatus.COUNTER_NOT_FOUND);
   return null;
 }
}

代码示例来源:origin: org.infinispan/infinispan-embedded-query

@Override
protected <K, V> void matchEvent(EventWrapper<K, V, CacheEntryEvent<K, V>> eventWrapper, Matcher matcher) {
 CacheEntryEvent<?, ?> event = eventWrapper.getEvent();
 Object oldValue = event.getType() == Event.Type.CACHE_ENTRY_REMOVED ? ((CacheEntryRemovedEvent) event).getOldValue() : null;
 if (event.getType() == Event.Type.CACHE_ENTRY_MODIFIED) {
   oldValue = ((EventImpl) event).getOldValue();
 }
 Object newValue = event.getValue();
 if (event.getType() == Event.Type.CACHE_ENTRY_EXPIRED) {
   oldValue = newValue;   // expired events have the expired value as newValue
   newValue = null;
 }
 if (oldValue != null || newValue != null) {
   if (oldValue != null && oldValue.getClass() == WrappedByteArray.class) {
    oldValue = ((WrappedByteArray) oldValue).getBytes();
   }
   if (newValue != null && newValue.getClass() == WrappedByteArray.class) {
    newValue = ((WrappedByteArray) newValue).getBytes();
   }
   matcher.matchDelta(eventWrapper, event.getType(), oldValue, newValue, joiningEvent, updatedEvent, leavingEvent);
 }
}

代码示例来源:origin: org.infinispan/infinispan-query

@Override
protected <K, V> void matchEvent(EventWrapper<K, V, CacheEntryEvent<K, V>> eventWrapper, Matcher matcher) {
 CacheEntryEvent<?, ?> event = eventWrapper.getEvent();
 Object oldValue = event.getType() == Event.Type.CACHE_ENTRY_REMOVED ? ((CacheEntryRemovedEvent) event).getOldValue() : null;
 if (event.getType() == Event.Type.CACHE_ENTRY_MODIFIED) {
   oldValue = ((EventImpl) event).getOldValue();
 }
 Object newValue = event.getValue();
 if (event.getType() == Event.Type.CACHE_ENTRY_EXPIRED) {
   oldValue = newValue;   // expired events have the expired value as newValue
   newValue = null;
 }
 if (oldValue != null || newValue != null) {
   if (oldValue != null && oldValue.getClass() == WrappedByteArray.class) {
    oldValue = ((WrappedByteArray) oldValue).getBytes();
   }
   if (newValue != null && newValue.getClass() == WrappedByteArray.class) {
    newValue = ((WrappedByteArray) newValue).getBytes();
   }
   matcher.matchDelta(eventWrapper, event.getType(), oldValue, newValue, joiningEvent, updatedEvent, leavingEvent);
 }
}

代码示例来源:origin: org.infinispan/infinispan-server-hotrod

private List<UserListener<?>> add(String counterName, List<UserListener<?>> list, UserListener<?> listener) {
 if (list == null) {
   CounterListenerOp op = createListener(client.protocolVersion(), counterName, listenerId.getBytes());
   client.writeOp(op);
   TestResponse response = client.getResponse(op);
   switch (response.getStatus()) {
    case Success:
      break;
    case OperationNotExecuted:
      break;
    case KeyDoesNotExist:
      throw new CounterException("Counter " + counterName + " doesn't exist");
    default:
      throw new IllegalStateException("Unknown status " + response.getStatus());
   }
   list = new CopyOnWriteArrayList<>();
 }
 list.add(listener);
 return list;
}

代码示例来源:origin: org.infinispan/infinispan-server-hotrod

private void remove(String counterName, UserListener<?> listener) {
 userListenerList.computeIfPresent(counterName, (name, list) -> {
   list.remove(listener);
   if (list.isEmpty()) {
    CounterListenerOp op = removeListener(client.protocolVersion(), counterName, listenerId.getBytes());
    client.writeOp(op);
    TestResponse response = client.getResponse(op);
    switch (response.getStatus()) {
      case Success:
       break;
      case OperationNotExecuted:
       break;
      case KeyDoesNotExist:
       throw new CounterException("Counter " + counterName + " doesn't exist");
      default:
       throw new IllegalStateException("Unknown status " + response.getStatus());
    }
    return null;
   }
   return list;
 });
}

代码示例来源:origin: org.infinispan/infinispan-commons

private Object convertToObject(Object content, MediaType contentType, MediaType destinationType) {
 if (contentType.match(APPLICATION_OCTET_STREAM)) {
   byte[] decoded = StandardConversions.decodeOctetStream(content, destinationType);
   return StandardConversions.convertOctetStreamToJava(decoded, destinationType, javaMarshaller);
 }
 if (contentType.match(APPLICATION_OBJECT)) {
   return StandardConversions.decodeObjectContent(content, contentType);
 }
 if (contentType.match(TEXT_PLAIN)) {
   return StandardConversions.convertTextToObject(content, contentType);
 }
 if (contentType.match(APPLICATION_WWW_FORM_URLENCODED)) {
   return StandardConversions.convertUrlEncodedToObject(content);
 }
 if (contentType.equals(MediaType.APPLICATION_UNKNOWN)) {
   if (content instanceof byte[]) {
    return tryDeserialize((byte[]) content);
   }
   if (content instanceof WrappedByteArray) {
    return tryDeserialize(((WrappedByteArray) content).getBytes());
   }
   return content;
 }
 throw log.unsupportedContent(content);
}

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com