All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.epics.pvmanager.test.BrokenWriteChannel Maven / Gradle / Ivy

/**
 * Copyright (C) 2010-12 Brookhaven National Laboratory
 * All rights reserved. Use is subject to license terms.
 */
package org.epics.pvmanager.test;

import org.epics.pvmanager.ChannelWriteCallback;
import org.epics.pvmanager.MultiplexedChannelHandler;
import org.epics.pvmanager.*;

/**
 * Implementation for channels of a {@link TestDataSource}.
 *
 * @author carcassi
 */
class BrokenWriteChannel extends MultiplexedChannelHandler {

    BrokenWriteChannel(String channelName) {
        super(channelName);
    }

    @Override
    public void connect() {
        processConnection(new Object());
    }

    @Override
    public void disconnect() {
        processConnection(null);
    }

    @Override
    public void write(Object newValue, ChannelWriteCallback callback) {
        try {
            callback.channelWritten(new RuntimeException("BrokenWriteChannel"));
        } catch (Exception ex) {
            callback.channelWritten(ex);
        }
    }
    
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy