Example usage for org.apache.commons.lang3 SerializationUtils clone

List of usage examples for org.apache.commons.lang3 SerializationUtils clone

Introduction

In this page you can find the example usage for org.apache.commons.lang3 SerializationUtils clone.

Prototype

public static <T extends Serializable> T clone(final T object) 

Source Link

Document

Deep clone an Object using serialization.

This is many times slower than writing clone methods by hand on all objects in your object graph.

Usage

From source file:org.energy_home.jemma.javagal.layers.business.implementations.GatewayEventManager.java

/**
 * {@inheritDoc}//  ww w .  ja  va  2s .  c o  m
 */
public void nodeRemoved(final Status status, final WSNNode node) throws Exception {
    LOG.debug("\n\rNodeDiscovered :" + String.format("%04X", node.getAddress().getNetworkAddress()) + "\n\r");

    executor.execute(new Runnable() {
        public void run() {
            for (GatewayDeviceEventEntry<?> gl : getGal().getListGatewayEventListener()) {
                boolean _ReportLeave = ((gl.getFreshnessMask() & DISCOVERY_LEAVE) != 0);
                if (_ReportLeave) {
                    Status cstatus = null;
                    WSNNode cnode = null;
                    synchronized (status) {
                        cstatus = SerializationUtils.clone(status);
                    }
                    synchronized (node) {
                        cnode = SerializationUtils.clone(node);
                    }
                    gl.getGatewayEventListener().nodeRemoved(cstatus, cnode);
                }
            }

        }
    });

}

From source file:org.energy_home.jemma.javagal.layers.business.implementations.GatewayEventManager.java

/**
 * {@inheritDoc}/*from w  w w .  ja  v  a2s. co m*/
 */
public void notifyleaveResult(final int _requestIdentifier, final Status status) {
    executor.execute(new Runnable() {
        public void run() {
            for (GatewayDeviceEventEntry<?> gl : getGal().getListGatewayEventListener()) {
                if (gl.getProxyIdentifier() == _requestIdentifier) {
                    Status cstatus = null;
                    synchronized (status) {
                        cstatus = SerializationUtils.clone(status);
                    }

                    gl.getGatewayEventListener().leaveResult(cstatus);
                }
            }

        }
    });

}

From source file:org.energy_home.jemma.javagal.layers.business.implementations.GatewayEventManager.java

/**
 * {@inheritDoc}/*from  w  w w .  j ava 2  s.c  om*/
 */
public void notifyleaveResult(final Status status) {
    executor.execute(new Runnable() {
        public void run() {

            for (GatewayDeviceEventEntry<?> gl : getGal().getListGatewayEventListener()) {
                Status cstatus = null;
                synchronized (status) {
                    cstatus = SerializationUtils.clone(status);
                }
                gl.getGatewayEventListener().leaveResult(cstatus);
            }

        }
    });

}

From source file:org.energy_home.jemma.javagal.layers.business.implementations.GatewayEventManager.java

/**
 * {@inheritDoc}//  w ww  .  j ava  2 s.co m
 */
public void notifyleaveResultExtended(final int _requestIdentifier, final Status status,
        final Address address) {
    executor.execute(new Runnable() {
        public void run() {
            for (GatewayDeviceEventEntry<?> gl : getGal().getListGatewayEventListener()) {
                if (gl.getProxyIdentifier() == _requestIdentifier)
                    if (gl.getGatewayEventListener() instanceof GatewayEventListenerExtended) {

                        Status cstatus = null;
                        Address caddress = null;
                        synchronized (status) {
                            cstatus = SerializationUtils.clone(status);
                        }
                        synchronized (address) {
                            caddress = SerializationUtils.clone(address);
                        }

                        ((GatewayEventListenerExtended) gl.getGatewayEventListener())
                                .leaveResultExtended(cstatus, caddress);
                    }
            }

        }
    });

}

From source file:org.energy_home.jemma.javagal.layers.business.implementations.GatewayEventManager.java

/**
 * {@inheritDoc}//from   w  w w  .  j av  a  2 s .com
 */
public void notifyleaveResultExtended(final Status status, final Address address) {
    executor.execute(new Runnable() {
        public void run() {
            for (GatewayDeviceEventEntry<?> gl : getGal().getListGatewayEventListener()) {
                if (gl.getGatewayEventListener() instanceof GatewayEventListenerExtended) {
                    Status cstatus = null;
                    Address caddress = null;
                    synchronized (status) {
                        cstatus = SerializationUtils.clone(status);
                    }
                    synchronized (address) {
                        caddress = SerializationUtils.clone(address);
                    }
                    ((GatewayEventListenerExtended) gl.getGatewayEventListener()).leaveResultExtended(cstatus,
                            caddress);
                }
            }

        }
    });

}

From source file:org.energy_home.jemma.javagal.layers.business.implementations.GatewayEventManager.java

/**
 * {@inheritDoc}// w w  w  .j a  v a2s  . c om
 */
public void notifyserviceDescriptorRetrieved(final int _requestIdentifier, final Status status,
        final ServiceDescriptor service) {
    executor.execute(new Runnable() {
        public void run() {
            for (GatewayDeviceEventEntry<?> gl : getGal().getListGatewayEventListener()) {
                if (gl.getProxyIdentifier() == _requestIdentifier) {
                    Status cstatus = null;
                    ServiceDescriptor cservice = null;
                    synchronized (status) {
                        cstatus = SerializationUtils.clone(status);
                    }
                    synchronized (service) {
                        cservice = SerializationUtils.clone(service);
                    }

                    gl.getGatewayEventListener().serviceDescriptorRetrieved(cstatus, cservice);
                }
            }

        }
    });

}

From source file:org.energy_home.jemma.javagal.layers.business.implementations.GatewayEventManager.java

/**
 * {@inheritDoc}//from ww  w.ja  v  a  2s .c  o  m
 */
public void notifynodeBindingsRetrieved(final int _requestIdentifier, final Status status,
        final BindingList bindings) {

    executor.execute(new Runnable() {
        public void run() {
            for (GatewayDeviceEventEntry<?> gl : getGal().getListGatewayEventListener()) {
                if (gl.getProxyIdentifier() == _requestIdentifier) {
                    Status cstatus = null;
                    BindingList cbindings = null;
                    synchronized (status) {
                        cstatus = SerializationUtils.clone(status);
                    }
                    synchronized (bindings) {
                        cbindings = SerializationUtils.clone(bindings);
                    }

                    gl.getGatewayEventListener().nodeBindingsRetrieved(cstatus, cbindings);
                }
            }

        }
    });

}

From source file:org.energy_home.jemma.javagal.layers.business.implementations.GatewayEventManager.java

/**
 * {@inheritDoc}/*from w  ww . j  av a2  s.c o m*/
 */
public void notifybindingResult(final int _requestIdentifier, final Status status) {
    executor.execute(new Runnable() {
        public void run() {
            for (GatewayDeviceEventEntry<?> gl : getGal().getListGatewayEventListener()) {
                if (gl.getProxyIdentifier() == _requestIdentifier) {
                    Status cstatus = null;
                    synchronized (status) {
                        cstatus = SerializationUtils.clone(status);
                    }
                    gl.getGatewayEventListener().bindingResult(cstatus);
                }
            }

        }
    });

}

From source file:org.energy_home.jemma.javagal.layers.business.implementations.GatewayEventManager.java

/**
 * {@inheritDoc}//  w  w  w  .j  a v a  2 s. c o  m
 */
public void notifyUnbindingResult(final int _requestIdentifier, final Status status) {
    executor.execute(new Runnable() {
        public void run() {

            for (GatewayDeviceEventEntry<?> gl : getGal().getListGatewayEventListener()) {
                if (gl.getProxyIdentifier() == _requestIdentifier) {
                    Status cstatus = null;
                    synchronized (status) {
                        cstatus = SerializationUtils.clone(status);
                    }
                    gl.getGatewayEventListener().unbindingResult(cstatus);
                }
            }

        }
    });
}

From source file:org.energy_home.jemma.javagal.layers.business.implementations.GatewayEventManager.java

/**
 * {@inheritDoc}//w  w w.  j  a v  a2  s . co  m
 */
public void notifyZDPEvent(final ZDPMessage message) {
    executor.execute(new Runnable() {
        public void run() {
            for (GatewayDeviceEventEntry<?> gl : getGal().getListGatewayEventListener()) {
                if (gl.getGatewayEventListener() instanceof GatewayEventListenerExtended) {
                    ZDPMessage cmessage = null;
                    synchronized (message) {
                        cmessage = SerializationUtils.clone(message);
                    }

                    ((GatewayEventListenerExtended) gl.getGatewayEventListener()).notifyZDPCommand(cmessage);
                }
            }

        }
    });

}