本文整理匯總了Java中com.gemstone.gemfire.pdx.internal.PdxType類的典型用法代碼示例。如果您正苦於以下問題:Java PdxType類的具體用法?Java PdxType怎麽用?Java PdxType使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
PdxType類屬於com.gemstone.gemfire.pdx.internal包,在下文中一共展示了PdxType類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: processResponse
import com.gemstone.gemfire.pdx.internal.PdxType; //導入依賴的package包/類
@Override
protected Object processResponse(Message msg) throws Exception {
Part part = msg.getPart(0);
int msgType = msg.getMessageType();
if (msgType == MessageType.RESPONSE) {
return (Map<Integer, PdxType>) part.getObject();
} else {
if (msgType == MessageType.EXCEPTION) {
String s = "While performing a remote " + "getPdxTypes";
throw new ServerOperationException(s, (Throwable) part.getObject());
} else if (isErrorResponse(msgType)) {
throw new ServerOperationException(part.getString());
} else {
throw new InternalGemFireError("Unexpected message type "
+ MessageType.getString(msgType));
}
}
}
示例2: testBasics
import com.gemstone.gemfire.pdx.internal.PdxType; //導入依賴的package包/類
public void testBasics() throws IOException, ClassNotFoundException {
PdxInstanceFactory c = PdxInstanceFactoryImpl.newCreator("basics", false);
c.writeInt("intField", 37);
PdxInstance pi = c.create();
WritablePdxInstance wpi = pi.createWriter();
assertEquals(true, wpi.hasField("intField"));
assertEquals(37, wpi.getField("intField"));
assertEquals(false, wpi.isIdentityField("intField"));
wpi.setField("intField", 38);
assertEquals(38, wpi.getField("intField"));
checkPdxInstance(wpi);
PdxType t1 = ((PdxInstanceImpl)pi).getPdxType();
PdxInstanceFactory c2 = PdxInstanceFactoryImpl.newCreator("basics", false);
c2.writeInt("intField", 46);
PdxInstance pi2 = c2.create();
PdxType t2 = ((PdxInstanceImpl)pi2).getPdxType();
assertEquals(t1, t2);
assertEquals(t1.getTypeId(), t2.getTypeId());
}
示例3: fromData
import com.gemstone.gemfire.pdx.internal.PdxType; //導入依賴的package包/類
public void fromData(DataInput in) throws IOException, ClassNotFoundException
{
int typeCount = in.readInt();
for (int i = 0; i < typeCount; ++i)
{
PdxType type = (PdxType) DataSerializer.readObject(in);
this.types.put(Integer.valueOf(type.getTypeId()), type);
}
int enumCount = in.readInt();
for (int i = 0; i < enumCount; ++i)
{
int id = in.readInt();
EnumInfo ei = (EnumInfo) DataSerializer.readObject(in);
this.enums.put(Integer.valueOf(id), ei);
}
}
示例4: readPdxSerializable
import com.gemstone.gemfire.pdx.internal.PdxType; //導入依賴的package包/類
private static final Object readPdxSerializable(final DataInput in)
throws IOException, ClassNotFoundException {
int len = in.readInt();
int typeId = in.readInt();
GemFireCacheImpl gfc = GemFireCacheImpl.getForPdx("PDX registry is unavailable because the Cache has been closed.");
PdxType pdxType = gfc.getPdxRegistry().getType(typeId);
if (DEBUG) {
gfc.getLogger().info("readPdxSerializable pdxType="+ pdxType);
}
if (pdxType == null) {
throw new IllegalStateException("Unknown pdx type=" + typeId);
}
DMStats dmStats = getDMStats(gfc);
dmStats.incPdxDeserialization(len+9);
// check if PdxInstance needs to be returned.
if (pdxType.getNoDomainClass() || gfc.getPdxReadSerializedByAnyGemFireServices()) {
// if (DEBUG) {
// gfc.getLogger().info("returning PdxInstance", new Exception("stack trace"));
// }
dmStats.incPdxInstanceCreations();
return new PdxInstanceImpl(pdxType, in, len);
} else {
// if (DEBUG) {
// gfc.getLogger().info("returning domain object", new Exception("stack trace"));
// }
// return domain object.
PdxReaderImpl pdxReader = new PdxReaderImpl(pdxType, in, len);
return pdxReader.getObject();
}
}
示例5: cmdExecute
import com.gemstone.gemfire.pdx.internal.PdxType; //導入依賴的package包/類
@Override
public void cmdExecute(Message msg, ServerConnection servConn, long start)
throws IOException, ClassNotFoundException {
servConn.setAsTrue(REQUIRES_RESPONSE);
if (logger.fineEnabled()) {
logger.fine(servConn.getName() + ": Received get pdx types from "
+ servConn.getSocketString());
}
Map<Integer, PdxType> types;
try {
GemFireCacheImpl cache = (GemFireCacheImpl) servConn.getCache();
types = cache.getPdxRegistry().typeMap();
} catch (Exception e) {
writeException(msg, e, false, servConn);
servConn.setAsTrue(RESPONDED);
return;
}
Message responseMsg = servConn.getResponseMessage();
responseMsg.setMessageType(MessageType.RESPONSE);
responseMsg.setNumberOfParts(1);
responseMsg.setTransactionId(msg.getTransactionId());
responseMsg.addObjPart(types);
responseMsg.send(servConn, logger, msg.getTransactionId());
servConn.setAsTrue(RESPONDED);
}
示例6: cmdExecute
import com.gemstone.gemfire.pdx.internal.PdxType; //導入依賴的package包/類
@Override
public void cmdExecute(Message msg, ServerConnection servConn, long start)
throws IOException, ClassNotFoundException {
servConn.setAsTrue(REQUIRES_RESPONSE);
if (logger.fineEnabled()) {
logger.fine(servConn.getName()
+ ": Received get pdx type by id request ("
+ msg.getNumberOfParts() + " parts) from "
+ servConn.getSocketString());
}
int pdxId = msg.getPart(0).getInt();
PdxType type;
try {
GemFireCacheImpl cache = (GemFireCacheImpl) servConn.getCache();
TypeRegistry registry = cache.getPdxRegistry();
type = registry.getType(pdxId);
} catch (Exception e) {
writeException(msg, e, false, servConn);
servConn.setAsTrue(RESPONDED);
return;
}
Message responseMsg = servConn.getResponseMessage();
responseMsg.setMessageType(MessageType.RESPONSE);
responseMsg.setNumberOfParts(1);
responseMsg.setTransactionId(msg.getTransactionId());
responseMsg.addObjPart(type);
responseMsg.send(servConn, logger, msg.getTransactionId());
servConn.setAsTrue(RESPONDED);
}
示例7: cmdExecute
import com.gemstone.gemfire.pdx.internal.PdxType; //導入依賴的package包/類
@Override
public void cmdExecute(Message msg, ServerConnection servConn, long start)
throws IOException, ClassNotFoundException {
servConn.setAsTrue(REQUIRES_RESPONSE);
if (logger.fineEnabled()) {
logger.fine(servConn.getName()
+ ": Received get pdx id for type request ("
+ msg.getNumberOfParts() + " parts) from "
+ servConn.getSocketString());
}
int noOfParts = msg.getNumberOfParts();
PdxType type = (PdxType) msg.getPart(0).getObject();
int pdxId;
try {
GemFireCacheImpl cache = (GemFireCacheImpl) servConn.getCache();
TypeRegistry registry = cache.getPdxRegistry();
pdxId = registry.defineType(type);
} catch (Exception e) {
writeException(msg, e, false, servConn);
servConn.setAsTrue(RESPONDED);
return;
}
Message responseMsg = servConn.getResponseMessage();
responseMsg.setMessageType(MessageType.RESPONSE);
responseMsg.setNumberOfParts(1);
responseMsg.setTransactionId(msg.getTransactionId());
responseMsg.addIntPart(pdxId);
responseMsg.send(servConn, logger, msg.getTransactionId());
servConn.setAsTrue(RESPONDED);
}
示例8: cmdExecute
import com.gemstone.gemfire.pdx.internal.PdxType; //導入依賴的package包/類
@Override
public void cmdExecute(Message msg, ServerConnection servConn, long start)
throws IOException, ClassNotFoundException {
servConn.setAsTrue(REQUIRES_RESPONSE);
if (logger.fineEnabled()) {
logger.fine(servConn.getName()
+ ": Received get pdx id for type request ("
+ msg.getNumberOfParts() + " parts) from "
+ servConn.getSocketString());
}
int noOfParts = msg.getNumberOfParts();
PdxType type = (PdxType) msg.getPart(0).getObject();
int typeId = msg.getPart(1).getInt();
//The native client needs this line
//because it doesn't set the type id on the
//client side.
type.setTypeId(typeId);
try {
GemFireCacheImpl cache = (GemFireCacheImpl) servConn.getCache();
TypeRegistry registry = cache.getPdxRegistry();
registry.addRemoteType(typeId, type);
} catch (Exception e) {
writeException(msg, e, false, servConn);
servConn.setAsTrue(RESPONDED);
return;
}
writeReply(msg, servConn);
servConn.setAsTrue(RESPONDED);
}
示例9: checkPdxTypeCompatibility
import com.gemstone.gemfire.pdx.internal.PdxType; //導入依賴的package包/類
private void checkPdxTypeCompatibility() {
TypeRegistry tr = getRegistry();
if (tr == null) {
return;
}
for (Map.Entry<Integer, PdxType> entry : pdx.types().entrySet()) {
tr.addImportedType(entry.getKey(), entry.getValue());
}
}
示例10: fromData
import com.gemstone.gemfire.pdx.internal.PdxType; //導入依賴的package包/類
public void fromData(DataInput in) throws IOException, ClassNotFoundException {
int typeCount = in.readInt();
for (int i = 0; i < typeCount; i++) {
PdxType type = DataSerializer.readObject(in);
types.put(type.getTypeId(), type);
}
int enumCount = in.readInt();
for (int i = 0; i < enumCount; i++) {
int id = in.readInt();
EnumInfo ei = DataSerializer.readObject(in);
enums.put(id, ei);
}
}
示例11: execute
import com.gemstone.gemfire.pdx.internal.PdxType; //導入依賴的package包/類
/**
* Register a bunch of instantiators on a server
* using connections from the given pool
* to communicate with the server.
* @param pool the pool to use to communicate with the server.
*/
public static void execute(ExecutablePool pool, int id,
PdxType type)
{
AbstractOp op = new AddPDXTypeOpImpl(pool.getLoggerI18n(), id, type);
pool.execute(op);
}
示例12: execute
import com.gemstone.gemfire.pdx.internal.PdxType; //導入依賴的package包/類
/**
* Get a PdxType from the given pool.
* @param pool the pool to use to communicate with the server.
*/
public static PdxType execute(ExecutablePool pool,
int pdxId)
{
AbstractOp op = new GetPDXTypeByIdOpImpl(pool.getLoggerI18n(), pdxId);
return (PdxType) pool.execute(op);
}
示例13: execute
import com.gemstone.gemfire.pdx.internal.PdxType; //導入依賴的package包/類
/**
* Register a bunch of instantiators on a server
* using connections from the given pool
* to communicate with the server.
* @param pool the pool to use to communicate with the server.
*/
public static int execute(ExecutablePool pool,
PdxType type)
{
AbstractOp op = new GetPDXIdForTypeOpImpl(pool.getLoggerI18n(), type);
return ((Integer) pool.execute(op)).intValue();
}
示例14: xtestPeer
import com.gemstone.gemfire.pdx.internal.PdxType; //導入依賴的package包/類
public void xtestPeer() throws Exception {
Region r = getCache().getRegion("pdxtest");
r.get(1);
TypeRegistry tr = ((GemFireCacheImpl) getCache()).getPdxRegistry();
Collection<PdxType> types = tr.typeMap().values();
assertEquals(MyObjectPdx.class.getName(), types.iterator().next().getClassName());
Collection<EnumInfo> enums = tr.enumMap().values();
assertEquals(MyEnumPdx.const1.name(), enums.iterator().next().getEnum().name());
}
示例15: testFieldInsert
import com.gemstone.gemfire.pdx.internal.PdxType; //導入依賴的package包/類
public void testFieldInsert() throws Exception {
MyEvolvablePdx.setVersion(1);
MyEvolvablePdx pdx = new MyEvolvablePdx(7);
assertEquals(7, pdx.f1);
assertEquals(0, pdx.f2);
MyEvolvablePdx.setVersion(3);
pdx = new MyEvolvablePdx(7);
assertEquals(7, pdx.f1);
assertEquals(8, pdx.f2);
byte[] v3actual = createBlob(pdx);
int v3typeId = getBlobPdxTypeId(v3actual);
c.getPdxRegistry().removeLocal(pdx);
MyEvolvablePdx.setVersion(1);
MyEvolvablePdx pdxv1 = deblob(v3actual);
assertEquals(7, pdxv1.f1);
assertEquals(0, pdxv1.f2);
// now reserialize and make sure f2 is preserved
byte[] v1actual = createBlob(pdxv1);
int mergedTypeId = getBlobPdxTypeId(v1actual);
assertEquals(v3typeId+1, mergedTypeId);
TypeRegistry tr = c.getPdxRegistry();
PdxType v3Type = tr.getType(v3typeId);
PdxType mergedType = tr.getType(mergedTypeId);
assertFalse(mergedType.equals(v3Type));
assertTrue(mergedType.compatible(v3Type));
MyEvolvablePdx.setVersion(3);
c.getPdxRegistry().removeLocal(pdxv1);
MyEvolvablePdx pdxv3 = deblob(v1actual);
assertEquals(7, pdxv3.f1);
assertEquals(8, pdxv3.f2);
}