public void registerClasses(Kryo kryo) { kryo.register(AvgCount.class, new FieldSerializer(kryo, AvgCount.class)); } }
private static void removeField(Kryo kryo, Class type, String fieldName) { FieldSerializer fld = new FieldSerializer(kryo, type); fld.removeField(fieldName); kryo.register(type, fld); }
@Override public Serializer newSerializer( final Class<?> type ) { if( HIBERNATE_ABSTRACT_COLLECTION_CLASS == null ) { return null; } else if ( HIBERNATE_ABSTRACT_COLLECTION_CLASS.isAssignableFrom( type ) ) { return new FieldSerializer( _kryo, type ); } return null; }
@Override public Serializer newSerializer( final Class<?> type ) { if ( SERIALIZED_CLASS_NAME.equals( type.getName() ) ) { return new FieldSerializer( _kryo, type ); } return null; }
@Override public Serializer makeSerializer(Kryo kryo, Class<?> type) { final FieldSerializer result = new FieldSerializer<Component>(kryo, type); result.setIgnoreSyntheticFields(false); return result; } });
@Override public Serializer newDefaultSerializer( final Kryo kryo, final Class<?> type ) { final FieldSerializer result = new FieldSerializer( kryo, type ); result.setIgnoreSyntheticFields( false ); return result; }
@Override public void customize(Kryo kryo) { kryo.setReferences(true); kryo.register( GrailsFlashScope.class, new FieldSerializer( kryo, GrailsFlashScope.class ) ); }
protected RelDataTypeSerializer(final Kryo kryo, final Class type, final RelDataTypeFactory typeFactory) { this.typeFactory = Preconditions.checkNotNull(typeFactory, "factory is required"); this.delegate = new FieldSerializer<>(kryo, type); }
/** * Creates and initializes new serializer for a given fastutil class. * @param kryo Kryo instance * @param type Fastutil class */ public FastUtilSerializer(Kryo kryo, Class<T> type) { fieldSerializer = new FieldSerializer<>(kryo, type); fieldSerializer.setIgnoreSyntheticFields(false); try { writeMethod = type.getDeclaredMethod( "writeObject", ObjectOutputStream.class); writeMethod.setAccessible(true); readMethod = type.getDeclaredMethod( "readObject", ObjectInputStream.class); readMethod.setAccessible(true); } catch (NoSuchMethodException e) { throw new RuntimeException( "Fastutil class " + type + " doesn't have readObject/writeObject methods", e); } try { outputWrapper = new FastutilKryoObjectOutputStream(); inputWrapper = new FastutilKryoObjectInputStream(); } catch (IOException e) { throw new RuntimeException(e); } }
return serializer; } else { FieldSerializer serializer = new FieldSerializer<>(kryo, type); serializer.setIgnoreSyntheticFields(false); return serializer;
public static Kryo createKryo() { kryo = new Kryo(); FieldSerializer<MeasurePointData> someClassSerializer = new FieldSerializer<MeasurePointData>(kryo, MeasurePointData.class); someClassSerializer.getField("measurePointId").setSerializer(new MeasurePointIdSerializer()); kryo.register(MeasurePointData.class, someClassSerializer); return kryo; }
f.stack.resumeStack(); kryo.writeClass(output, f.getClass()); new FieldSerializer(kryo, f.getClass()).write(kryo, output, f); } finally { f.fiberLocals = tmpFiberLocals; new FieldSerializer(kryo, f.getClass()).write(kryo, output, f); } catch (Throwable t) { t.printStackTrace();
kryo.register(PlatformIdentIndexer.class, new FieldSerializer<PlatformIdentIndexer<?>>(kryo, PlatformIdentIndexer.class), nextRegistrationId++); kryo.register(ObjectTypeIndexer.class, new FieldSerializer<ObjectTypeIndexer<?>>(kryo, ObjectTypeIndexer.class), nextRegistrationId++); kryo.register(MethodIdentIndexer.class, new FieldSerializer<MethodIdentIndexer<?>>(kryo, MethodIdentIndexer.class), nextRegistrationId++); kryo.register(SensorTypeIdentIndexer.class, new FieldSerializer<SensorTypeIdentIndexer<?>>(kryo, SensorTypeIdentIndexer.class), nextRegistrationId++); kryo.register(TimestampIndexer.class, new CustomCompatibleFieldSerializer<TimestampIndexer<?>>(kryo, TimestampIndexer.class, schemaManager), nextRegistrationId++); kryo.register(InvocationChildrenIndexer.class, new FieldSerializer<InvocationChildrenIndexer<?>>(kryo, InvocationChildrenIndexer.class), nextRegistrationId++); kryo.register(SqlStringIndexer.class, new FieldSerializer<SqlStringIndexer<?>>(kryo, SqlStringIndexer.class), nextRegistrationId++); kryo.register(RecordingData.class, new FieldSerializer<RecordingData>(kryo, RecordingData.class), nextRegistrationId++); kryo.register(WritingStatus.class, new EnumSerializer(WritingStatus.class), nextRegistrationId++); kryo.register(AddLabelManagementAction.class, new FieldSerializer<AddLabelManagementAction>(kryo, AddLabelManagementAction.class), nextRegistrationId++); kryo.register(RemoveLabelManagementAction.class, new FieldSerializer<RemoveLabelManagementAction>(kryo, RemoveLabelManagementAction.class), nextRegistrationId++); kryo.register(DataAggregatorProcessor.class, new FieldSerializer<DataAggregatorProcessor<?>>(kryo, DataAggregatorProcessor.class), nextRegistrationId++); kryo.register(DataSaverProcessor.class, new FieldSerializer<DataSaverProcessor>(kryo, DataSaverProcessor.class), nextRegistrationId++); kryo.register(InvocationClonerDataProcessor.class, new FieldSerializer<InvocationClonerDataProcessor>(kryo, InvocationClonerDataProcessor.class), nextRegistrationId++); kryo.register(InvocationExtractorDataProcessor.class, new FieldSerializer<InvocationExtractorDataProcessor>(kryo, InvocationExtractorDataProcessor.class), nextRegistrationId++); kryo.register(TimeFrameDataProcessor.class, new FieldSerializer<TimeFrameDataProcessor>(kryo, TimeFrameDataProcessor.class), nextRegistrationId++); kryo.register(TimerDataAggregator.class, new FieldSerializer<TimerDataAggregator>(kryo, TimerDataAggregator.class), nextRegistrationId++); kryo.register(SqlStatementDataAggregator.class, new FieldSerializer<SqlStatementDataAggregator>(kryo, SqlStatementDataAggregator.class), nextRegistrationId++); kryo.register(HttpTimerDataAggregator.class, new FieldSerializer<HttpTimerDataAggregator>(kryo, HttpTimerDataAggregator.class), nextRegistrationId++); kryo.register(ExceptionDataAggregator.class, new FieldSerializer<ExceptionDataAggregator>(kryo, ExceptionDataAggregator.class), nextRegistrationId++); kryo.register(RecordingProperties.class, new FieldSerializer<RecordingProperties>(kryo, RecordingProperties.class), nextRegistrationId++); kryo.register(AgentFilterDataProcessor.class, new FieldSerializer<AgentFilterDataProcessor>(kryo, AgentFilterDataProcessor.class), nextRegistrationId++); kryo.register(GroupedProperty.class, new FieldSerializer<GroupedProperty>(kryo, GroupedProperty.class), nextRegistrationId++); kryo.register(BooleanProperty.class, new FieldSerializer<BooleanProperty>(kryo, BooleanProperty.class), nextRegistrationId++); kryo.register(BooleanPropertyUpdate.class, new FieldSerializer<BooleanPropertyUpdate>(kryo, BooleanPropertyUpdate.class), nextRegistrationId++);
@Override @SuppressWarnings("CallToPrintStackTrace") public Fiber read(Kryo kryo, Input input, Class<Fiber> type) { final Fiber f; final Thread currentThread = Thread.currentThread(); final Object tmpThreadLocals = ThreadAccess.getThreadLocals(currentThread); final Object tmpInheritableThreadLocals = ThreadAccess.getInheritableThreadLocals(currentThread); ThreadAccess.setThreadLocals(currentThread, null); ThreadAccess.setInheritableThreadLocals(currentThread, null); try { final Registration reg = kryo.readClass(input); if (reg == null) return null; f = (Fiber) new FieldSerializer(kryo, reg.getType()).read(kryo, input, reg.getType()); if (!f.noLocals) { f.fiberLocals = ThreadAccess.getThreadLocals(currentThread); f.inheritableFiberLocals = ThreadAccess.getInheritableThreadLocals(currentThread); } return f; } catch (Throwable t) { t.printStackTrace(); throw t; } finally { ThreadAccess.setThreadLocals(currentThread, tmpThreadLocals); ThreadAccess.setInheritableThreadLocals(currentThread, tmpInheritableThreadLocals); } } }
kryo.register(Timestamp.class, new TimestampSerializer()); kryo.register(Date.class, new DateSerializer()); kryo.register(AtomicLong.class, new FieldSerializer<AtomicLong>(kryo, AtomicLong.class)); kryo.register(MutableInt.class, new FieldSerializer<MutableInt>(kryo, MutableInt.class)); kryo.register(InvocationSequenceData.class, new InvocationSequenceCustomCompatibleFieldSerializer(kryo, InvocationSequenceData.class, schemaManager)); kryo.register(TimerData.class, new InvocationAwareDataSerializer<TimerData>(kryo, TimerData.class, schemaManager)); kryo.register(RemoteInvocation.class, new FieldSerializer<RemoteInvocation>(kryo, RemoteInvocation.class)); kryo.register(RemoteInvocationResult.class, new FieldSerializer<RemoteInvocationResult>(kryo, RemoteInvocationResult.class) { @Override protected RemoteInvocationResult create(Kryo kryo, Input input, Class<RemoteInvocationResult> type) { kryo.register(CmrStatusData.class, new FieldSerializer<CmrStatusData>(kryo, CmrStatusData.class)); kryo.register(AgentStatusData.class, new FieldSerializer<AgentStatusData>(kryo, AgentStatusData.class)); kryo.register(AgentConnection.class, new EnumSerializer(AgentConnection.class)); kryo.register(BusinessException.class, new FieldSerializer<BusinessException>(kryo, BusinessException.class), nextRegistrationId++); kryo.register(TechnicalException.class, new FieldSerializer<TechnicalException>(kryo, TechnicalException.class), nextRegistrationId++); kryo.register(RemoteException.class, new FieldSerializer<RemoteException>(kryo, RemoteException.class), nextRegistrationId++); kryo.register(StorageErrorCodeEnum.class, new EnumSerializer(StorageErrorCodeEnum.class), nextRegistrationId++); kryo.register(AgentManagementErrorCodeEnum.class, new EnumSerializer(AgentManagementErrorCodeEnum.class), nextRegistrationId++); kryo.register(InvocationTargetException.class, new FieldSerializer<InvocationTargetException>(kryo, InvocationTargetException.class) { @Override protected InvocationTargetException create(Kryo kryo, Input input, Class<InvocationTargetException> type) { kryo.register(AgentConfig.class, new FieldSerializer<AgentConfig>(kryo, AgentConfig.class), nextRegistrationId++); kryo.register(StrategyConfig.class, new FieldSerializer<StrategyConfig>(kryo, StrategyConfig.class), nextRegistrationId++); kryo.register(PlatformSensorTypeConfig.class, new FieldSerializer<PlatformSensorTypeConfig>(kryo, PlatformSensorTypeConfig.class), nextRegistrationId++);