public static ByteBuffer serializedWriteBuffer(Class<?> c, Object targetObj) throws InstantiationException, IllegalAccessException, IOException{
				
		ByteBuffer buffer = ByteBuffer.allocate(_defaultByteSize);
		Output out = null;
		_kryoMap.get().register(c);
		
		int retry = 10;
		while(retry-- != 0){
			
			logger.debug("Action Once");
			try {
				out = generateOutput(buffer);
				_kryoMap.get().writeObject(out, targetObj);
				break;
			} catch (Exception e) {
				if(e instanceof BufferOverflowException) {
					buffer = ByteBuffer.allocate(buffer.capacity() * 2);
					logger.info("object is too big:" + targetObj);
					continue;
				}
				if(e instanceof KryoException){
					KryoException kryoExcpetion = (KryoException) e;
					if(kryoExcpetion.getCause() instanceof BufferOverflowException){
						buffer = ByteBuffer.allocate(buffer.capacity() * 2);
						logger.info("object is too big:" + targetObj);
						continue;
					}
				}
				logger.error("[serializedWriteBuffer] Error!", e);
			}			
			
		}
		if(buffer.capacity() == buffer.position()){
			ByteBuffer tempBuffer = ByteBuffer.allocate(buffer.capacity());
			buffer.flip();
			tempBuffer.put(buffer);
			buffer.clear();
			out.flush();
			if(buffer.position() > 0){
				ByteBuffer newBuffer = ByteBuffer.allocate(buffer.capacity() + buffer.position());
				tempBuffer.flip();
				newBuffer.put(tempBuffer);
				buffer.flip();
				newBuffer.put(buffer);
				buffer = newBuffer;
			}
		} else {
			out.flush();
		}
	
		return buffer;
	}