@Override public ConnectorDescriptorId createConnectorDescriptor(IConnectorDescriptor conn) { ConnectorDescriptorId cdId = new ConnectorDescriptorId(connectorIdCounter++); conn.setConnectorId(cdId); connMap.put(cdId, conn); return cdId; }
public static ConnectorDescriptorId create(DataInput dis) throws IOException { ConnectorDescriptorId connectorDescriptorId = new ConnectorDescriptorId(); connectorDescriptorId.readFields(dis); return connectorDescriptorId; }
private static PartitionId readInitialMessage(ByteBuffer buffer) { JobId jobId = new JobId(buffer.getLong()); ConnectorDescriptorId cdid = new ConnectorDescriptorId(buffer.getInt()); int senderIndex = buffer.getInt(); int receiverIndex = buffer.getInt(); return new PartitionId(jobId, cdid, senderIndex, receiverIndex); }
private static PartitionId readPartitionId(DataInputStream dis) throws IOException { long jobId = dis.readLong(); int cdid = dis.readInt(); int senderIndex = dis.readInt(); int receiverIndex = dis.readInt(); PartitionId pid = new PartitionId(new JobId(jobId), new ConnectorDescriptorId(cdid), senderIndex, receiverIndex); return pid; }
@Test public void failedJobPartitionRequestTest() throws Exception { final NodeControllerService nc1 = integrationUtil.ncs[0]; final NodeControllerService nc2 = integrationUtil.ncs[1]; final JobId failedJob = new JobId(-1); nc2.getPartitionManager().jobCompleted(failedJob, JobStatus.FAILURE); final NetworkAddress localNetworkAddress = nc2.getNetworkManager().getPublicNetworkAddress(); final InetSocketAddress nc2Address = new InetSocketAddress(localNetworkAddress.getAddress(), localNetworkAddress.getPort()); PartitionId id = new PartitionId(failedJob, new ConnectorDescriptorId(1), 0, 1); NetworkInputChannel inputChannel = new NetworkInputChannel(nc1.getNetworkManager(), nc2Address, id, 1); InputChannelFrameReader frameReader = new InputChannelFrameReader(inputChannel); inputChannel.registerMonitor(frameReader); AtomicBoolean failed = new AtomicBoolean(false); Thread reader = new Thread(() -> { try { failed.set(!frameReader.nextFrame(new FixedSizeFrame())); } catch (HyracksDataException e) { e.printStackTrace(); } }); reader.start(); final IHyracksCommonContext context = Mockito.mock(IHyracksCommonContext.class); Mockito.when(context.getInitialFrameSize()).thenReturn(2000); inputChannel.open(context); reader.join(5000); Assert.assertTrue(failed.get()); } }
JobId jobId = nc.newJobId(); final IHyracksTaskContext ctx = nc.createTestContext(jobId, 0, true); final ConnectorDescriptorId codId = new ConnectorDescriptorId(1); final PartitionId pid = new PartitionId(ctx.getJobletContext().getJobId(), codId, 1, 1); final ChannelControlBlock ccb = ncs.getNetworkManager()