use of org.apache.ignite.configuration.BinaryConfiguration in project ignite by apache.
the class BinaryConfigurationConsistencySelfTest method testPositiveEmptyConfig.
/**
* @throws Exception If failed.
*/
public void testPositiveEmptyConfig() throws Exception {
binaryCfg = new BinaryConfiguration();
startGrids(2);
isClient = true;
startGrid(2);
}
use of org.apache.ignite.configuration.BinaryConfiguration in project ignite by apache.
the class BinaryConfigurationConsistencySelfTest method customConfig.
/**
* @return Custom BinaryConfiguration.
* @param compactFooter Compact footer.
*/
private BinaryConfiguration customConfig(boolean compactFooter) {
BinaryConfiguration c = new BinaryConfiguration();
c.setIdMapper(new BinaryBasicIdMapper(true));
c.setSerializer(new BinarySerializer() {
@Override
public void writeBinary(Object obj, BinaryWriter writer) throws BinaryObjectException {
// No-op.
}
@Override
public void readBinary(Object obj, BinaryReader reader) throws BinaryObjectException {
// No-op.
}
});
c.setCompactFooter(compactFooter);
BinaryTypeConfiguration btc = new BinaryTypeConfiguration("org.MyClass");
btc.setIdMapper(BinaryContext.defaultIdMapper());
btc.setEnum(false);
btc.setSerializer(new BinarySerializer() {
@Override
public void writeBinary(Object obj, BinaryWriter writer) throws BinaryObjectException {
// No-op.
}
@Override
public void readBinary(Object obj, BinaryReader reader) throws BinaryObjectException {
// No-op.
}
});
c.setTypeConfigurations(Arrays.asList(btc));
return c;
}
use of org.apache.ignite.configuration.BinaryConfiguration in project ignite by apache.
the class BinaryFieldExtractionSelfTest method createMarshaller.
/**
* Create marshaller.
*
* @return Binary marshaller.
* @throws Exception If failed.
*/
protected BinaryMarshaller createMarshaller() throws Exception {
BinaryContext ctx = new BinaryContext(BinaryCachingMetadataHandler.create(), new IgniteConfiguration(), log());
BinaryMarshaller marsh = new BinaryMarshaller();
BinaryConfiguration bCfg = new BinaryConfiguration();
IgniteConfiguration iCfg = new IgniteConfiguration();
iCfg.setBinaryConfiguration(bCfg);
marsh.setContext(new MarshallerContextTestImpl(null));
IgniteUtils.invoke(BinaryMarshaller.class, marsh, "setBinaryContext", ctx, iCfg);
return marsh;
}
use of org.apache.ignite.configuration.BinaryConfiguration in project ignite by apache.
the class GridCacheUtilsSelfTest method binaryMarshaller.
/**
* @return Binary marshaller.
* @throws IgniteCheckedException if failed.
*/
private BinaryMarshaller binaryMarshaller() throws IgniteCheckedException {
IgniteConfiguration iCfg = new IgniteConfiguration();
BinaryConfiguration bCfg = new BinaryConfiguration();
iCfg.setBinaryConfiguration(bCfg);
BinaryContext ctx = new BinaryContext(BinaryCachingMetadataHandler.create(), iCfg, new NullLogger());
BinaryMarshaller marsh = new BinaryMarshaller();
marsh.setContext(new MarshallerContextTestImpl(null));
IgniteUtils.invoke(BinaryMarshaller.class, marsh, "setBinaryContext", ctx, iCfg);
return marsh;
}
use of org.apache.ignite.configuration.BinaryConfiguration in project ignite by apache.
the class PlatformConfigurationUtils method readIgniteConfiguration.
/**
* Reads Ignite configuration.
* @param in Reader.
* @param cfg Configuration.
*/
public static void readIgniteConfiguration(BinaryRawReaderEx in, IgniteConfiguration cfg) {
if (in.readBoolean())
cfg.setClientMode(in.readBoolean());
int[] eventTypes = in.readIntArray();
if (eventTypes != null)
cfg.setIncludeEventTypes(eventTypes);
if (in.readBoolean())
cfg.setMetricsExpireTime(in.readLong());
if (in.readBoolean())
cfg.setMetricsHistorySize(in.readInt());
if (in.readBoolean())
cfg.setMetricsLogFrequency(in.readLong());
if (in.readBoolean())
cfg.setMetricsUpdateFrequency(in.readLong());
if (in.readBoolean())
cfg.setNetworkSendRetryCount(in.readInt());
if (in.readBoolean())
cfg.setNetworkSendRetryDelay(in.readLong());
if (in.readBoolean())
cfg.setNetworkTimeout(in.readLong());
String workDir = in.readString();
if (workDir != null)
cfg.setWorkDirectory(workDir);
String localHost = in.readString();
if (localHost != null)
cfg.setLocalHost(localHost);
if (in.readBoolean())
cfg.setDaemon(in.readBoolean());
if (in.readBoolean())
cfg.setLateAffinityAssignment(in.readBoolean());
if (in.readBoolean())
cfg.setFailureDetectionTimeout(in.readLong());
if (in.readBoolean())
cfg.setClientFailureDetectionTimeout(in.readLong());
readCacheConfigurations(in, cfg);
readDiscoveryConfiguration(in, cfg);
if (in.readBoolean()) {
TcpCommunicationSpi comm = new TcpCommunicationSpi();
comm.setAckSendThreshold(in.readInt());
comm.setConnectTimeout(in.readLong());
comm.setDirectBuffer(in.readBoolean());
comm.setDirectSendBuffer(in.readBoolean());
comm.setIdleConnectionTimeout(in.readLong());
comm.setLocalAddress(in.readString());
comm.setLocalPort(in.readInt());
comm.setLocalPortRange(in.readInt());
comm.setMaxConnectTimeout(in.readLong());
comm.setMessageQueueLimit(in.readInt());
comm.setReconnectCount(in.readInt());
comm.setSelectorsCount(in.readInt());
comm.setSlowClientQueueLimit(in.readInt());
comm.setSocketReceiveBuffer(in.readInt());
comm.setSocketSendBuffer(in.readInt());
comm.setTcpNoDelay(in.readBoolean());
comm.setUnacknowledgedMessagesBufferSize(in.readInt());
cfg.setCommunicationSpi(comm);
}
if (in.readBoolean()) {
// binary config is present
if (cfg.getBinaryConfiguration() == null)
cfg.setBinaryConfiguration(new BinaryConfiguration());
if (// compact footer is set
in.readBoolean())
cfg.getBinaryConfiguration().setCompactFooter(in.readBoolean());
if (in.readBoolean()) {
// Simple name mapper.
cfg.getBinaryConfiguration().setNameMapper(new BinaryBasicNameMapper(true));
}
}
int attrCnt = in.readInt();
if (attrCnt > 0) {
Map<String, Object> attrs = new HashMap<>(attrCnt);
for (int i = 0; i < attrCnt; i++) attrs.put(in.readString(), in.readObject());
cfg.setUserAttributes(attrs);
}
if (in.readBoolean()) {
AtomicConfiguration atomic = new AtomicConfiguration();
atomic.setAtomicSequenceReserveSize(in.readInt());
atomic.setBackups(in.readInt());
atomic.setCacheMode(CacheMode.fromOrdinal(in.readInt()));
cfg.setAtomicConfiguration(atomic);
}
if (in.readBoolean()) {
TransactionConfiguration tx = new TransactionConfiguration();
tx.setPessimisticTxLogSize(in.readInt());
tx.setDefaultTxConcurrency(TransactionConcurrency.fromOrdinal(in.readInt()));
tx.setDefaultTxIsolation(TransactionIsolation.fromOrdinal(in.readInt()));
tx.setDefaultTxTimeout(in.readLong());
tx.setPessimisticTxLogLinger(in.readInt());
cfg.setTransactionConfiguration(tx);
}
switch(in.readByte()) {
case 1:
cfg.setEventStorageSpi(new NoopEventStorageSpi());
break;
case 2:
cfg.setEventStorageSpi(new MemoryEventStorageSpi().setExpireCount(in.readLong()).setExpireAgeMs(in.readLong()));
break;
}
if (in.readBoolean())
cfg.setMemoryConfiguration(readMemoryConfiguration(in));
readPluginConfiguration(cfg, in);
}
Aggregations