Package org.apache.pig.penny

Examples of org.apache.pig.penny.PhysicalLocation


            // send registration message to master
            Tuple regResponse = senderReceiver.sendSync(createRegistrationMessage());

            // first part of registration response contains assigned physical
            // location id
            this.location = new PhysicalLocation(logicalLocation,
                    (Integer) regResponse.get(0));

            // next part of registration response contains pending incoming
            // async messages
            for (Iterator<Tuple> it = ((DataBag) regResponse.get(1)).iterator(); it
View Full Code Here


        }
       
        @Override
        public void channelDisconnected(ChannelHandlerContext ctx,
                ChannelStateEvent e) throws Exception {
            PhysicalLocation pl = (PhysicalLocation)ctx.getAttachment();
            if (pl != null) {
                plMap.remove(pl);
            }
            super.channelDisconnected(ctx, e);
        }
View Full Code Here

            if (m.type() == Type.DEREG) {
                channel.close();
            }
            if (t != null) {
                if (m.type() == Type.REG) {
                    PhysicalLocation pl = new PhysicalLocation(m.source().logId(), (Integer)t.get(0));
                    plMap.put(pl, channel);
                    ctx.setAttachment(pl);
                }
                Message rsp = new Message(m.type(), m.getAck(), m.destination(), m.source(), t);
                channel.write(rsp);
View Full Code Here

   
    public static Message fromTuple(Tuple t) throws IOException {
        Tuple body = (Tuple) t.get(0);
        Type type = stringToType((String) t.get(1));
        int ack = (Integer)t.get(2);
        Location source = (t.get(4) instanceof Integer)? new PhysicalLocation((String) t.get(3), (Integer) t.get(4)) : new LogicalLocation((String) t.get(3));
        Location destination = (t.get(6) instanceof Integer)? new PhysicalLocation((String) t.get(5), (Integer) t.get(6)) : new LogicalLocation((String) t.get(5));
        return new Message(type, ack, source, destination, body);
    }
View Full Code Here

            initLLState(logSrc);                    // first time we're seeing this logical location, so initialize some state for it
        }
       
        int physId = maxPhysicalIds.get(logSrc) + 1;
        maxPhysicalIds.put(logSrc, physId);
        PhysicalLocation physSrc = new PhysicalLocation(logSrc, physId);
   
        // create ack, which has two parts: (1) newly-assigned physical location id; (2) pending asynchronous messages
        Tuple ack = new DefaultTuple();
        ack.append(physSrc.physId());
        DataBag pendingMessages = BagFactory.getInstance().newDefaultBag();
        ack.append(pendingMessages);
       
        for (Message rm : rendezvousMessages.get(logSrc)) {
            pendingMessages.add(rm.toTuple());
View Full Code Here

                initLLState(dst.asLogical());            // first time we're seeing this logical location, so initialize some state for it
            }
           
            // send to all currently registered physical instances of the logical destination
            for (int physId = 0; physId <= maxPhysicalIds.get(dst); physId++) {
                senderReceiver.sendAsync(message, new PhysicalLocation((LogicalLocation)dst, physId));
            }
           
            // put on rendezvous list -- to be sent to any additional physical instances that register in the future
            rendezvousMessages.get(dst).add(message);
        } else {
View Full Code Here

TOP

Related Classes of org.apache.pig.penny.PhysicalLocation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.