private void check() { if (done) { throw new HazelcastSerializationException("ClassDefinition is already built for " + classId); } }
/** * If the given exception has "java.lang.ClassCastException: cannot assign * instance of java.lang.invoke.SerializedLambda" in the causes, wrap it in * another JetException explaining the possible reason. * <p> * This is a hack to improve readability of this common exception. * * @param e the exception to handle * @return the given exception wrapped, if it is a case of CCE for SerializedLambda * or the given exception otherwise */ public static RuntimeException handleSerializedLambdaCce(HazelcastSerializationException e) { Throwable cause = e.getCause(); while (cause != null) { if (cause instanceof ClassCastException && cause.getMessage().startsWith("cannot assign instance of java.lang.invoke.SerializedLambda")) { throw new JetException("Class containing the lambda probably missing from class path, did you add it " + "using JobConfig.addClass()?: " + e, e); } cause = cause.getCause(); } throw e; } }
void sessionDeferredWrite() { if (sessionChanged() || isNew()) { Map<String, Object> updates = new HashMap<String, Object>(); Iterator<Map.Entry<String, LocalCacheEntry>> iterator = localCache.entrySet().iterator(); while (iterator.hasNext()) { Map.Entry<String, LocalCacheEntry> entry = iterator.next(); LocalCacheEntry cacheEntry = entry.getValue(); if (cacheEntry.isDirty() && !cacheEntry.isTransient()) { if (cacheEntry.isRemoved()) { updates.put(entry.getKey(), null); } else { updates.put(entry.getKey(), cacheEntry.getValue()); } cacheEntry.setDirty(false); } } try { webFilter.getClusteredSessionService().updateAttributes(id, updates); } catch (HazelcastSerializationException e) { LOGGER.warning("Failed to serialize session with ID [" + id + "]:" + e.getMessage(), e); } catch (Exception e) { LOGGER.warning("Unexpected error occurred.", e); } } }
entry.setDirty(false); } catch (HazelcastSerializationException e) { WebFilter.LOGGER.warning("Failed to serialize attribute [" + name + "]:" + e.getMessage(), e); } catch (Exception ignored) { EmptyStatement.ignore(ignored);
@Override public Throwable createException(String message, Throwable cause) { return new HazelcastSerializationException(message, cause); } });
entry.setDirty(false); } catch (HazelcastSerializationException e) { LOGGER.warning("Failed to serialize attribute [" + name + "]:" + e.getMessage(), e); } catch (Exception e) { LOGGER.warning("Unexpected error occurred.", e);
private static HazelcastSerializationException newHazelcastSerializationException(int typeId) { return new HazelcastSerializationException("There is no suitable de-serializer for type " + typeId + ". " + "This exception is likely to be caused by differences in the serialization configuration between members " + "or between clients and members."); }
private static HazelcastSerializationException newHazelcastSerializationException(int typeId) { return new HazelcastSerializationException("There is no suitable de-serializer for type " + typeId + ". " + "This exception is likely to be caused by differences in the serialization configuration between members " + "or between clients and members."); }
private void check() { if (done) { throw new HazelcastSerializationException("ClassDefinition is already built for " + classId); } }
@Override public Throwable createException(String message, Throwable cause) { return new HazelcastSerializationException(message, cause); } });
private IOException rethrowReadException(int id, int factoryId, String className, Exception e) throws IOException { if (e instanceof IOException) { throw (IOException) e; } if (e instanceof HazelcastSerializationException) { throw (HazelcastSerializationException) e; } throw new HazelcastSerializationException("Problem while reading DataSerializable, namespace: " + factoryId + ", ID: " + id + ", class: '" + className + "'" + ", exception: " + e.getMessage(), e); }
private IOException rethrowReadException(int id, int factoryId, String className, Exception e) throws IOException { if (e instanceof IOException) { throw (IOException) e; } if (e instanceof HazelcastSerializationException) { throw (HazelcastSerializationException) e; } throw new HazelcastSerializationException("Problem while reading DataSerializable, namespace: " + factoryId + ", ID: " + id + ", class: '" + className + "'" + ", exception: " + e.getMessage(), e); }
private Portable createNewPortableInstance(int factoryId, int classId) { final PortableFactory portableFactory = factories.get(factoryId); if (portableFactory == null) { throw new HazelcastSerializationException("Could not find PortableFactory for factory-id: " + factoryId); } final Portable portable = portableFactory.create(classId); if (portable == null) { throw new HazelcastSerializationException("Could not create Portable for class-id: " + classId); } return portable; }
private Portable createNewPortableInstance(int factoryId, int classId) { final PortableFactory portableFactory = factories.get(factoryId); if (portableFactory == null) { throw new HazelcastSerializationException("Could not find PortableFactory for factory-id: " + factoryId); } final Portable portable = portableFactory.create(classId); if (portable == null) { throw new HazelcastSerializationException("Could not create Portable for class-id: " + classId); } return portable; }
public static InputStream convertToInputStream(DataInput in, int offset) { if (!(in instanceof ByteArrayObjectDataInput)) { throw new HazelcastSerializationException("Cannot convert " + in.getClass().getName() + " to input stream"); } ByteArrayObjectDataInput byteArrayInput = (ByteArrayObjectDataInput) in; return new ByteArrayInputStream(byteArrayInput.data, offset, byteArrayInput.size - offset); }
static RuntimeException handleSerializeException(Object rootObject, Throwable e) { if (e instanceof OutOfMemoryError) { OutOfMemoryErrorDispatcher.onOutOfMemory((OutOfMemoryError) e); throw (Error) e; } if (e instanceof Error) { throw (Error) e; } String clazz = rootObject == null ? "null" : rootObject.getClass().getName(); throw new HazelcastSerializationException("Failed to serialize '" + clazz + '\'', e); }
private void skipBytesSafely(ObjectDataInput input, int count) throws IOException { if (input.skipBytes(count) != count) { throw new HazelcastSerializationException("Malformed serialization format"); } }
static RuntimeException handleSerializeException(Object rootObject, Throwable e) { if (e instanceof OutOfMemoryError) { OutOfMemoryErrorDispatcher.onOutOfMemory((OutOfMemoryError) e); throw (Error) e; } if (e instanceof Error) { throw (Error) e; } String clazz = rootObject == null ? "null" : rootObject.getClass().getName(); throw new HazelcastSerializationException("Failed to serialize '" + clazz + '\'', e); }
private void skipBytesSafely(ObjectDataInput input, int count) throws IOException { if (input.skipBytes(count) != count) { throw new HazelcastSerializationException("Malformed serialization format"); } }
static RuntimeException handleException(Throwable e) { if (e instanceof OutOfMemoryError) { OutOfMemoryErrorDispatcher.onOutOfMemory((OutOfMemoryError) e); throw (Error) e; } if (e instanceof Error) { throw (Error) e; } if (e instanceof HazelcastSerializationException) { throw (HazelcastSerializationException) e; } throw new HazelcastSerializationException(e); }