class RemotePacketExecution implements ClusterTask<Void> {

    private JID recipient;
    private Packet packet;

    public RemotePacketExecution() {
    }

    public RemotePacketExecution(JID recipient, Packet packet) {
        this.recipient = recipient;
        this.packet = packet;
    }

    public Void getResult() {
        return null;
    }

    public void run() {
        // Route packet to entity hosted by this node. If delivery fails then the routing table
        // will inform the proper router of the failure and the router will handle the error reply logic
        XMPPServer.getInstance().getRoutingTable().routePacket(recipient, packet);
    }

    public void writeExternal(ObjectOutput out) throws IOException {<FILL_FUNCTION_BODY>}

    public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
        recipient = (JID) ExternalizableUtil.getInstance().readSerializable(in);

        int packetType = ExternalizableUtil.getInstance().readInt(in);
        Element packetElement = (Element) ExternalizableUtil.getInstance().readSerializable(in);
        switch (packetType) {
            case 1:
                packet = new IQ(packetElement, true);
                break;
            case 2:
                packet = new Message(packetElement, true);
                break;
            case 3:
                packet = new Presence(packetElement, true);
                break;
        }
    }

    public String toString() {
        return super.toString() + " recipient: " + recipient + "packet: " + packet;
    }
}

        ExternalizableUtil.getInstance().writeSerializable(out, recipient);
        if (packet instanceof IQ) {
            ExternalizableUtil.getInstance().writeInt(out, 1);
        }
        else if (packet instanceof Message) {
            ExternalizableUtil.getInstance().writeInt(out, 2);
        }
        else if (packet instanceof Presence) {
            ExternalizableUtil.getInstance().writeInt(out, 3);
        }
        ExternalizableUtil.getInstance().writeSerializable(out, (DefaultElement) packet.getElement());
    
<no_super_class>