@Override public BufferObjectDataOutput takeOutputBuffer() { BufferObjectDataOutput out = outputQueue.poll(); if (out == null) { out = serializationService.createObjectDataOutput(); } return out; }
@Override public BufferObjectDataOutput takeOutputBuffer() { BufferObjectDataOutput out = outputQueue.poll(); if (out == null) { out = serializationService.createObjectDataOutput(); } return out; }
@Nonnull public static BufferObjectDataOutput createObjectDataOutput(@Nonnull NodeEngine engine) { return ((InternalSerializationService) engine.getSerializationService()) .createObjectDataOutput(BUFFER_SIZE); }
public static void writeCompressedData(ObjectDataOutput out, Object data) throws IOException { InternalSerializationService ss = (InternalSerializationService) out.getSerializationService(); ObjectDataOutput tmp = ss.createObjectDataOutput(); tmp.writeObject(data); out.writeByteArray(IOUtil.compress(tmp.toByteArray())); }
@Override public void writeData(ObjectDataOutput out) throws IOException { InternalSerializationService ss = (InternalSerializationService) out.getSerializationService(); ObjectDataOutput tmp = ss.createObjectDataOutput(); super.writeData(tmp); out.writeByteArray(IOUtil.compress(tmp.toByteArray())); }
public static void writeCompressedContent(ObjectDataOutput out, ContentSerializer<Object> cs, Object data) throws IOException { InternalSerializationService ss = (InternalSerializationService) out.getSerializationService(); ObjectDataOutput tmp = ss.createObjectDataOutput(); cs.writeContent(tmp, data); out.writeByteArray(IOUtil.compress(tmp.toByteArray())); } }
private MulticastService(Node node, MulticastSocket multicastSocket) throws Exception { this.logger = node.getLogger(MulticastService.class.getName()); this.node = node; this.multicastSocket = multicastSocket; NodeIOService nodeIOService = new NodeIOService(node, node.nodeEngine); this.inputProcessor = node.getNodeExtension().createMulticastInputProcessor(nodeIOService); this.outputProcessor = node.getNodeExtension().createMulticastOutputProcessor(nodeIOService); this.sendOutput = node.getSerializationService().createObjectDataOutput(SEND_OUTPUT_SIZE); Config config = node.getConfig(); MulticastConfig multicastConfig = config.getNetworkConfig().getJoin().getMulticastConfig(); this.datagramPacketSend = new DatagramPacket(new byte[0], 0, InetAddress.getByName(multicastConfig.getMulticastGroup()), multicastConfig.getMulticastPort()); this.datagramPacketReceive = new DatagramPacket(new byte[DATAGRAM_BUFFER_SIZE], DATAGRAM_BUFFER_SIZE); Set<String> trustedInterfaces = multicastConfig.getTrustedInterfaces(); ILogger logger = node.getLogger(JoinMessageTrustChecker.class); joinMessageTrustChecker = new JoinMessageTrustChecker(trustedInterfaces, logger); }
private MulticastService(Node node, MulticastSocket multicastSocket) throws Exception { this.logger = node.getLogger(MulticastService.class.getName()); this.node = node; this.multicastSocket = multicastSocket; NodeIOService nodeIOService = new NodeIOService(node, node.nodeEngine); this.inputProcessor = node.getNodeExtension().createMulticastInputProcessor(nodeIOService); this.outputProcessor = node.getNodeExtension().createMulticastOutputProcessor(nodeIOService); this.sendOutput = node.getSerializationService().createObjectDataOutput(SEND_OUTPUT_SIZE); Config config = node.getConfig(); MulticastConfig multicastConfig = config.getNetworkConfig().getJoin().getMulticastConfig(); this.datagramPacketSend = new DatagramPacket(new byte[0], 0, InetAddress.getByName(multicastConfig.getMulticastGroup()), multicastConfig.getMulticastPort()); this.datagramPacketReceive = new DatagramPacket(new byte[DATAGRAM_BUFFER_SIZE], DATAGRAM_BUFFER_SIZE); Set<String> trustedInterfaces = multicastConfig.getTrustedInterfaces(); ILogger logger = node.getLogger(JoinMessageTrustChecker.class); joinMessageTrustChecker = new JoinMessageTrustChecker(trustedInterfaces, logger); }
private void storeContent(DocumentKey docKey, Object content) throws BagriException { if (cacheContent) { // ddSvc.storeData(docKey, content, CN_XDM_CONTENT); // do this asynchronously!? if (compressContent) { InternalSerializationService ss = ddSvc.getSerializationService(); ObjectDataOutput tmp = ss.createObjectDataOutput(); try { tmp.writeObject(content); content = IOUtil.compress(tmp.toByteArray()); } catch (IOException ex) { throw new BagriException(ex, ecDocument); } } cntCache.set(docKey, content); } }
@Override public void writeData(ObjectDataOutput out) throws IOException { int sz = size(); out.writeInt(sz); if (sz > 0) { InternalSerializationService ss = (InternalSerializationService) out.getSerializationService(); ObjectDataOutput tmp = ss.createObjectDataOutput(); writeResults(tmp); byte[] data = tmp.toByteArray(); //logger.trace("writeData; original size: {}; ", data.length); // it hangs here if number of docs in the cursor = 0 (data.length = 4); byte[] data2 = IOUtil.compress(data); //logger.trace("writeData; original size: {}; compressed size: {}", data.length, data2.length); out.writeByteArray(data2); } }