use of org.apache.ignite.internal.processors.marshaller.MappingExchangeResult in project ignite by apache.
the class MarshallerContextImpl method registerClassName.
/**
* {@inheritDoc}
*/
@Override
public boolean registerClassName(byte platformId, int typeId, String clsName) throws IgniteCheckedException {
ConcurrentMap<Integer, MappedName> cache = getCacheFor(platformId);
MappedName mappedName = cache.get(typeId);
if (mappedName != null) {
if (!mappedName.className().equals(clsName))
throw new DuplicateTypeIdException(platformId, typeId, mappedName.className(), clsName);
else {
if (mappedName.accepted())
return true;
if (transport.stopping())
return false;
IgniteInternalFuture<MappingExchangeResult> fut = transport.awaitMappingAcceptance(new MarshallerMappingItem(platformId, typeId, clsName), cache);
MappingExchangeResult res = fut.get();
return convertXchRes(res);
}
} else {
if (transport.stopping())
return false;
IgniteInternalFuture<MappingExchangeResult> fut = transport.proposeMapping(new MarshallerMappingItem(platformId, typeId, clsName), cache);
MappingExchangeResult res = fut.get();
return convertXchRes(res);
}
}
use of org.apache.ignite.internal.processors.marshaller.MappingExchangeResult in project ignite by apache.
the class MarshallerContextImpl method registerClassName.
/**
* {@inheritDoc}
*/
@Override
public boolean registerClassName(byte platformId, int typeId, String clsName, boolean failIfUnregistered) throws IgniteCheckedException {
ConcurrentMap<Integer, MappedName> cache = getCacheFor(platformId);
MappedName mappedName = cache.get(typeId);
if (mappedName != null) {
if (!mappedName.className().equals(clsName))
throw new DuplicateTypeIdException(platformId, typeId, mappedName.className(), clsName);
else {
if (mappedName.accepted())
return true;
if (transport.stopping())
return false;
MarshallerMappingItem item = new MarshallerMappingItem(platformId, typeId, clsName);
GridFutureAdapter<MappingExchangeResult> fut = transport.awaitMappingAcceptance(item, cache);
if (failIfUnregistered && !fut.isDone())
throw new UnregisteredBinaryTypeException(typeId, fut);
MappingExchangeResult res = fut.get();
return convertXchRes(res);
}
} else {
if (transport.stopping())
return false;
MarshallerMappingItem item = new MarshallerMappingItem(platformId, typeId, clsName);
GridFutureAdapter<MappingExchangeResult> fut = transport.proposeMapping(item, cache);
if (failIfUnregistered && !fut.isDone())
throw new UnregisteredBinaryTypeException(typeId, fut);
MappingExchangeResult res = fut.get();
return convertXchRes(res);
}
}
Aggregations