Example usage for java.util.concurrent CopyOnWriteArrayList CopyOnWriteArrayList

List of usage examples for java.util.concurrent CopyOnWriteArrayList CopyOnWriteArrayList

Introduction

In this page you can find the example usage for java.util.concurrent CopyOnWriteArrayList CopyOnWriteArrayList.

Prototype

public CopyOnWriteArrayList() 

Source Link

Document

Creates an empty list.

Usage

From source file:net.rptools.maptool.client.ui.MapToolFrame.java

public MapToolFrame(JMenuBar menuBar) {
    // Set up the frame
    super(AppConstants.APP_NAME);

    this.menuBar = menuBar;

    setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
    addWindowListener(this);
    setSize(WINDOW_WIDTH, WINDOW_HEIGHT);
    SwingUtil.centerOnScreen(this);
    setFocusTraversalPolicy(new MapToolFocusTraversalPolicy());

    try {/*  ww  w . j  a  v a2  s .c  o  m*/
        setIconImage(ImageUtil.getImage(MINILOGO_IMAGE));
    } catch (IOException ioe) {
        String msg = I18N.getText("msg.error.loadingIconImage");
        log.error(msg, ioe);
        System.err.println(msg);
    }
    // Notify duration
    initializeNotifyDuration();

    // Components
    glassPane = new GlassPane();
    assetPanel = createAssetPanel();
    connectionPanel = createConnectionPanel();
    toolbox = new Toolbox();
    initiativePanel = createInitiativePanel();

    zoneRendererList = new CopyOnWriteArrayList<ZoneRenderer>();
    pointerOverlay = new PointerOverlay();
    colorPicker = new ColorPicker(this);
    textureChooserPanel = new TextureChooserPanel(colorPicker.getPaintChooser(), assetPanel.getModel(),
            "imageExplorerTextureChooser");
    colorPicker.getPaintChooser().addPaintChooser(textureChooserPanel);

    String credits = "";
    String version = "";
    Image logo = null;
    try {
        credits = new String(FileUtil.loadResource(CREDITS_HTML), "UTF-8"); // 2nd param of type Charset is Java6+
        version = MapTool.getVersion();
        credits = credits.replace("%VERSION%", version);
        logo = ImageUtil.getImage(MAPTOOL_LOGO_IMAGE);
    } catch (Exception ioe) {
        log.error(I18N.getText("msg.error.credits"), ioe);
        ioe.printStackTrace();
    }
    aboutDialog = new AboutDialog(this, logo, credits);
    aboutDialog.setSize(354, 400);

    statusPanel = new StatusPanel();
    statusPanel.addPanel(getCoordinateStatusBar());
    statusPanel.addPanel(getZoomStatusBar());
    statusPanel.addPanel(MemoryStatusBar.getInstance());
    // statusPanel.addPanel(progressBar);
    statusPanel.addPanel(connectionStatusPanel);
    statusPanel.addPanel(activityMonitor);
    statusPanel.addPanel(new SpacerStatusBar(25));

    zoneMiniMapPanel = new ZoneMiniMapPanel();
    zoneMiniMapPanel.setSize(100, 100);

    zoneRendererPanel = new JPanel(new PositionalLayout(5));
    zoneRendererPanel.setBackground(Color.black);
    //      zoneRendererPanel.add(zoneMiniMapPanel, PositionalLayout.Position.SE);
    //      zoneRendererPanel.add(getChatTypingLabel(), PositionalLayout.Position.NW);
    zoneRendererPanel.add(getChatTypingPanel(), PositionalLayout.Position.NW);
    zoneRendererPanel.add(getChatActionLabel(), PositionalLayout.Position.SW);

    commandPanel = new CommandPanel();
    MapTool.getMessageList().addObserver(commandPanel);

    rendererBorderPanel = new JPanel(new GridLayout());
    rendererBorderPanel.setBorder(BorderFactory.createLineBorder(Color.darkGray));
    rendererBorderPanel.add(zoneRendererPanel);

    // Put it all together
    setJMenuBar(menuBar);
    add(BorderLayout.NORTH, new ToolbarPanel(toolbox));
    add(BorderLayout.SOUTH, statusPanel);

    JLayeredPane glassPaneComposite = new JLayeredPane();
    glassPaneComposite.setLayout(new GridBagLayout());
    GridBagConstraints constraints = new GridBagConstraints();
    constraints.gridx = 1;
    constraints.gridy = 1;
    constraints.fill = GridBagConstraints.BOTH;
    constraints.weightx = 1;
    constraints.weighty = 1;

    glassPaneComposite.add(glassPane, constraints);
    glassPaneComposite.add(dragImageGlassPane, constraints);

    setGlassPane(glassPane);
    //      setGlassPane(glassPaneComposite);

    glassPaneComposite.setVisible(true);

    if (!MapTool.MAC_OS_X)
        removeWindowsF10();
    else
        registerForMacOSXEvents();

    MapTool.getEventDispatcher().addListener(this, MapTool.ZoneEvent.Activated);

    restorePreferences();
    updateKeyStrokes();

    // This will cause the frame to be set to visible (BAD jide, BAD! No cookie for you!)
    configureDocking();

    new WindowPreferences(AppConstants.APP_NAME, "mainFrame", this);
    chatTyperObserver = new ChatTyperObserver();
    chatTyperTimers = new ChatNotificationTimers();
    chatTyperTimers.addObserver(chatTyperObserver);
    chatTimer = getChatTimer();
    setChatTypingLabelColor(AppPreferences.getChatNotificationColor());
}

From source file:com.all.messengine.impl.DefaultMessEngine.java

@Override
public void addMessageListener(String type, MessageListener<? extends Message<?>> listener) {
    List<MessageListener<? extends Message<?>>> list = listeners.get(type);
    if (list == null) {
        list = new CopyOnWriteArrayList<MessageListener<? extends Message<?>>>();
        listeners.put(type, list);/*from  ww w . ja v  a 2  s  . c  o m*/
    }
    list.add(listener);
}

From source file:org.apache.flink.runtime.executiongraph.ExecutionGraph.java

public ExecutionGraph(ScheduledExecutorService futureExecutor, Executor ioExecutor, JobID jobId, String jobName,
        Configuration jobConfig, SerializedValue<ExecutionConfig> serializedConfig, Time timeout,
        RestartStrategy restartStrategy, List<BlobKey> requiredJarFiles, List<URL> requiredClasspaths,
        SlotProvider slotProvider, ClassLoader userClassLoader, MetricGroup metricGroup) throws IOException {

    checkNotNull(futureExecutor);//from ww w .ja v  a 2  s  .c o  m
    checkNotNull(jobId);
    checkNotNull(jobName);
    checkNotNull(jobConfig);

    this.jobInformation = new JobInformation(jobId, jobName, serializedConfig, jobConfig, requiredJarFiles,
            requiredClasspaths);

    // serialize the job information to do the serialisation work only once
    this.serializedJobInformation = new SerializedValue<>(jobInformation);

    this.futureExecutor = Preconditions.checkNotNull(futureExecutor);
    this.ioExecutor = Preconditions.checkNotNull(ioExecutor);

    this.slotProvider = Preconditions.checkNotNull(slotProvider, "scheduler");
    this.userClassLoader = Preconditions.checkNotNull(userClassLoader, "userClassLoader");

    this.tasks = new ConcurrentHashMap<>(16);
    this.intermediateResults = new ConcurrentHashMap<>(16);
    this.verticesInCreationOrder = new ArrayList<>(16);
    this.currentExecutions = new ConcurrentHashMap<>(16);

    this.jobStatusListeners = new CopyOnWriteArrayList<>();
    this.executionListeners = new CopyOnWriteArrayList<>();

    this.stateTimestamps = new long[JobStatus.values().length];
    this.stateTimestamps[JobStatus.CREATED.ordinal()] = System.currentTimeMillis();

    this.rpcCallTimeout = checkNotNull(timeout);
    this.scheduleAllocationTimeout = checkNotNull(timeout);

    this.restartStrategy = restartStrategy;

    metricGroup.gauge(RESTARTING_TIME_METRIC_NAME, new RestartTimeGauge());

    this.kvStateLocationRegistry = new KvStateLocationRegistry(jobId, getAllVertices());
}

From source file:com.cisco.oss.foundation.http.netlifx.netty.NettyNetflixHttpClient.java

private InternalServerProxyMetadata loadServersMetadataConfiguration() {

    Configuration subset = ConfigurationFactory.getConfiguration().subset(getApiName());
    final Iterator<String> keysIterator = subset.getKeys();

    // read default values
    int readTimeout = subset.getInt("http." + LoadBalancerConstants.READ_TIME_OUT,
            LoadBalancerConstants.DEFAULT_READ_TIMEOUT);
    int connectTimeout = subset.getInt("http." + LoadBalancerConstants.CONNECT_TIME_OUT,
            LoadBalancerConstants.DEFAULT_CONNECT_TIMEOUT);
    long waitingTime = subset.getLong("http." + LoadBalancerConstants.WAITING_TIME,
            LoadBalancerConstants.DEFAULT_WAITING_TIME);
    int numberOfAttempts = subset.getInt("http." + LoadBalancerConstants.NUMBER_OF_ATTEMPTS,
            LoadBalancerConstants.DEFAULT_NUMBER_OF_ATTEMPTS);
    long retryDelay = subset.getLong("http." + LoadBalancerConstants.RETRY_DELAY,
            LoadBalancerConstants.DEFAULT_RETRY_DELAY);

    long idleTimeout = subset.getLong("http." + LoadBalancerConstants.IDLE_TIME_OUT,
            LoadBalancerConstants.DEFAULT_IDLE_TIMEOUT);
    int maxConnectionsPerAddress = subset.getInt("http." + LoadBalancerConstants.MAX_CONNECTIONS_PER_ADDRESS,
            LoadBalancerConstants.DEFAULT_MAX_CONNECTIONS_PER_ADDRESS);
    int maxConnectionsTotal = subset.getInt("http." + LoadBalancerConstants.MAX_CONNECTIONS_TOTAL,
            LoadBalancerConstants.DEFAULT_MAX_CONNECTIONS_TOTAL);
    int maxQueueSizePerAddress = subset.getInt("http." + LoadBalancerConstants.MAX_QUEUE_PER_ADDRESS,
            LoadBalancerConstants.DEFAULT_MAX_QUEUE_PER_ADDRESS);
    boolean followRedirects = subset.getBoolean("http." + LoadBalancerConstants.FOLLOW_REDIRECTS, false);
    boolean disableCookies = subset.getBoolean("http." + LoadBalancerConstants.DISABLE_COOKIES, false);
    boolean autoCloseable = subset.getBoolean("http." + LoadBalancerConstants.AUTO_CLOSEABLE, true);
    boolean autoEncodeUri = subset.getBoolean("http." + LoadBalancerConstants.AUTO_ENCODE_URI, true);
    boolean staleConnectionCheckEnabled = subset
            .getBoolean("http." + LoadBalancerConstants.IS_STALE_CONN_CHECK_ENABLED, false);
    boolean serviceDirectoryEnabled = subset
            .getBoolean("http." + LoadBalancerConstants.SERVICE_DIRECTORY_IS_ENABLED, false);
    String serviceName = subset.getString("http." + LoadBalancerConstants.SERVICE_DIRECTORY_SERVICE_NAME,
            "UNKNOWN");

    String keyStorePath = subset.getString("http." + LoadBalancerConstants.KEYSTORE_PATH, "");
    String keyStorePassword = subset.getString("http." + LoadBalancerConstants.KEYSTORE_PASSWORD, "");
    String trustStorePath = subset.getString("http." + LoadBalancerConstants.TRUSTSTORE_PATH, "");
    String trustStorePassword = subset.getString("http." + LoadBalancerConstants.TRUSTSTORE_PASSWORD, "");
    startEurekaClient = subset.getBoolean("http.startEurekaClient", true);

    final List<String> keys = new ArrayList<String>();

    while (keysIterator.hasNext()) {
        String key = keysIterator.next();
        keys.add(key);/*  w w  w  .j  a v a  2s.co m*/
    }

    Collections.sort(keys);

    List<Pair<String, Integer>> hostAndPortPairs = new CopyOnWriteArrayList<Pair<String, Integer>>();

    for (String key : keys) {

        if (key.contains(LoadBalancerConstants.HOST)) {

            String host = subset.getString(key);

            // trim the host name
            if (org.apache.commons.lang.StringUtils.isNotEmpty(host)) {
                host = host.trim();
            }
            final String portKey = key.replace(LoadBalancerConstants.HOST, LoadBalancerConstants.PORT);
            if (subset.containsKey(portKey)) {
                int port = subset.getInt(portKey);
                // save host and port for future creation of server list
                hostAndPortPairs.add(Pair.of(host, port));
            }
        }

    }

    InternalServerProxyMetadata metadata = new InternalServerProxyMetadata(readTimeout, connectTimeout,
            idleTimeout, maxConnectionsPerAddress, maxConnectionsTotal, maxQueueSizePerAddress, waitingTime,
            numberOfAttempts, retryDelay, hostAndPortPairs, keyStorePath, keyStorePassword, trustStorePath,
            trustStorePassword, followRedirects, autoCloseable, staleConnectionCheckEnabled, disableCookies,
            serviceDirectoryEnabled, serviceName, autoEncodeUri);

    return metadata;

}

From source file:org.hawkular.listener.cache.InventoryHelperTest.java

@Test
public void shouldListNoMetricsForTypeWhenTagsDontMatchIndex() {
    // Data & mocks
    String tenant = "tenant";
    String feed = "feed";
    Metric<String> r1 = new Metric<>("inventory.123.r.r1", null, 7, MetricType.STRING, null);
    long currentTime = System.currentTimeMillis();
    when(metricsService.findMetricsWithFilters(anyString(), anyObject(), anyString()))
            .thenAnswer(invocationOnMock -> Observable.just(r1));
    when(metricsService.findStringData(r1.getMetricId(), 0, currentTime, false, 0, Order.DESC))
            .thenReturn(Observable.just(buildRootResourceDatapointWithoutMetric(currentTime - 500, "r1")));
    org.hawkular.inventory.api.model.MetricType.Blueprint bp = org.hawkular.inventory.api.model.MetricType.Blueprint
            .builder(MetricDataType.GAUGE).withId("metricType1").withName("Metric type 1").withInterval(60L)
            .withUnit(MetricUnit.BYTES).build();

    // Test & assertions
    List<org.hawkular.inventory.api.model.Metric.Blueprint> collected = new CopyOnWriteArrayList<>();
    InventoryHelper.listMetricsForType(metricsService, tenant, feed, bp, currentTime).toList()
            .subscribe(collected::addAll, Throwables::propagate);
    Assert.assertTrue(collected.isEmpty());
}

From source file:org.openhie.openempi.blocking.basicblockinghp.cache.BlockingServiceCache.java

@SuppressWarnings("unchecked")
public List<Record> loadCandidateRecords(String blockingKeyValue) {
    List<Record> records = new java.util.ArrayList<Record>();
    for (BlockingRound round : blockingRounds) {
        //         log.debug("Loading records for round: " + round.getName());
        Cache cache = cacheByRound.get(round.getName());
        if (cache == null) {
            log.error(/*from www  . j a v a  2  s.  c  o  m*/
                    "Unexpected error occured; unable to locate a cache for blocking round " + round.getName());
            throw new RuntimeException(
                    "Unable to locate a cache to retrieve blocking records from implying a system configuration issue.");
        }
        Element elem = cache.get(blockingKeyValue);
        if (elem == null) {
            continue;
        }
        List<Integer> pointers = new CopyOnWriteArrayList<Integer>();
        //List<Integer> pointers = (List<Integer>) elem.getValue();
        pointers = (List<Integer>) elem.getObjectValue();
        log.debug("Using key " + blockingKeyValue + " found " + pointers.size() + " candidate records.");
        records.addAll(blockRecords(pointers));
    }
    return records;
}

From source file:org.wso2.carbon.device.mgt.iot.output.adapter.ui.UIEventAdapter.java

/**
 * Fetches all valid web-socket sessions from the entire pool of subscribed sessions. The validity is checked
 * against any queryString provided when subscribing to the web-socket endpoint.
 *
 * @param event the current event received and that which needs to be published to subscribed sessions.
 * @return a list of all validated web-socket sessions against the queryString values.
 *//*from  www.j  av a  2 s  . co  m*/
private CopyOnWriteArrayList<WebSocketSessionRequest> getValidSessions(Event event) {
    CopyOnWriteArrayList<WebSocketSessionRequest> validSessions = new CopyOnWriteArrayList<>();
    UIOutputCallbackControllerServiceImpl uiOutputCallbackControllerServiceImpl = UIEventAdaptorServiceDataHolder
            .getUIOutputCallbackRegisterServiceImpl();
    // get all subscribed web-socket sessions.
    CopyOnWriteArrayList<WebSocketSessionRequest> webSocketSessionUtils = uiOutputCallbackControllerServiceImpl
            .getSessions(tenantId, streamId);
    if (webSocketSessionUtils != null) {
        for (WebSocketSessionRequest webSocketSessionUtil : webSocketSessionUtils) {
            boolean isValidSession = validateEventAgainstSessionFilters(event, webSocketSessionUtil);
            if (isValidSession) {
                validSessions.add(webSocketSessionUtil);
            }
        }
    }
    return validSessions;
}

From source file:com.microsoft.windowsazure.mobileservices.notifications.MobileServicePush.java

private ListenableFuture<Void> unregisterAllInternal(ArrayList<Registration> registrations) {
    final SettableFuture<Void> resultFuture = SettableFuture.create();

    final SyncState state = new SyncState();

    state.size = registrations.size();//from   www  .  j  av  a  2  s  .c  o  m

    final CopyOnWriteArrayList<String> concurrentArray = new CopyOnWriteArrayList<String>();

    final Object syncObject = new Object();

    if (state.size == 0) {

        removeAllRegistrationsId();

        mIsRefreshNeeded = false;

        resultFuture.set(null);

        return resultFuture;
    }

    for (final Registration registration : registrations) {

        ListenableFuture<Void> serviceFilterFuture = deleteRegistrationInternal(registration.getName(),
                registration.getRegistrationId());

        Futures.addCallback(serviceFilterFuture, new FutureCallback<Void>() {
            @Override
            public void onFailure(Throwable exception) {

                if (exception != null) {
                    synchronized (syncObject) {
                        if (!state.alreadyReturn) {
                            state.alreadyReturn = true;

                            resultFuture.setException(exception);

                            return;
                        }
                    }
                }
            }

            @Override
            public void onSuccess(Void v) {
                concurrentArray.add(registration.getRegistrationId());

                if (concurrentArray.size() == state.size && !state.alreadyReturn) {
                    removeAllRegistrationsId();

                    mIsRefreshNeeded = false;

                    resultFuture.set(null);

                    return;
                }
            }
        });
    }

    return resultFuture;
}

From source file:com.cisco.oss.foundation.http.AbstractHttpClient.java

private InternalServerProxyMetadata loadServersMetadataConfiguration() {

    Configuration subset = configuration.subset(apiName);
    final Iterator<String> keysIterator = subset.getKeys();

    // read default values
    int readTimeout = subset.getInt("http." + LoadBalancerConstants.READ_TIME_OUT,
            LoadBalancerConstants.DEFAULT_READ_TIMEOUT);
    int connectTimeout = subset.getInt("http." + LoadBalancerConstants.CONNECT_TIME_OUT,
            LoadBalancerConstants.DEFAULT_CONNECT_TIMEOUT);
    long waitingTime = subset.getLong("http." + LoadBalancerConstants.WAITING_TIME,
            LoadBalancerConstants.DEFAULT_WAITING_TIME);
    int numberOfAttempts = subset.getInt("http." + LoadBalancerConstants.NUMBER_OF_ATTEMPTS,
            LoadBalancerConstants.DEFAULT_NUMBER_OF_ATTEMPTS);
    long retryDelay = subset.getLong("http." + LoadBalancerConstants.RETRY_DELAY,
            LoadBalancerConstants.DEFAULT_RETRY_DELAY);

    long idleTimeout = subset.getLong("http." + LoadBalancerConstants.IDLE_TIME_OUT,
            LoadBalancerConstants.DEFAULT_IDLE_TIMEOUT);
    int maxConnectionsPerAddress = subset.getInt("http." + LoadBalancerConstants.MAX_CONNECTIONS_PER_ADDRESS,
            LoadBalancerConstants.DEFAULT_MAX_CONNECTIONS_PER_ADDRESS);
    int maxConnectionsTotal = subset.getInt("http." + LoadBalancerConstants.MAX_CONNECTIONS_TOTAL,
            LoadBalancerConstants.DEFAULT_MAX_CONNECTIONS_TOTAL);
    int maxQueueSizePerAddress = subset.getInt("http." + LoadBalancerConstants.MAX_QUEUE_PER_ADDRESS,
            LoadBalancerConstants.DEFAULT_MAX_QUEUE_PER_ADDRESS);
    boolean followRedirects = subset.getBoolean("http." + LoadBalancerConstants.FOLLOW_REDIRECTS, false);
    boolean disableCookies = subset.getBoolean("http." + LoadBalancerConstants.DISABLE_COOKIES, false);
    boolean autoCloseable = subset.getBoolean("http." + LoadBalancerConstants.AUTO_CLOSEABLE, true);
    boolean autoEncodeUri = subset.getBoolean("http." + LoadBalancerConstants.AUTO_ENCODE_URI, true);
    boolean staleConnectionCheckEnabled = subset
            .getBoolean("http." + LoadBalancerConstants.IS_STALE_CONN_CHECK_ENABLED, false);
    boolean serviceDirectoryEnabled = subset
            .getBoolean("http." + LoadBalancerConstants.SERVICE_DIRECTORY_IS_ENABLED, false);
    String serviceName = subset.getString("http." + LoadBalancerConstants.SERVICE_DIRECTORY_SERVICE_NAME,
            "UNKNOWN");

    String keyStorePath = subset.getString("http." + LoadBalancerConstants.KEYSTORE_PATH, "");
    String keyStorePassword = subset.getString("http." + LoadBalancerConstants.KEYSTORE_PASSWORD, "");
    String trustStorePath = subset.getString("http." + LoadBalancerConstants.TRUSTSTORE_PATH, "");
    String trustStorePassword = subset.getString("http." + LoadBalancerConstants.TRUSTSTORE_PASSWORD, "");

    final List<String> keys = new ArrayList<String>();

    while (keysIterator.hasNext()) {
        String key = keysIterator.next();
        keys.add(key);// w ww  .jav a2s .c  o  m
    }

    Collections.sort(keys);

    List<Pair<String, Integer>> hostAndPortPairs = new CopyOnWriteArrayList<Pair<String, Integer>>();

    for (String key : keys) {

        if (key.contains(LoadBalancerConstants.HOST)) {

            String host = subset.getString(key);

            // trim the host name
            if (StringUtils.isNotEmpty(host)) {
                host = host.trim();
            }
            final String portKey = key.replace(LoadBalancerConstants.HOST, LoadBalancerConstants.PORT);
            if (subset.containsKey(portKey)) {
                int port = subset.getInt(portKey);
                // save host and port for future creation of server list
                hostAndPortPairs.add(Pair.of(host, port));
            }
        }

    }

    InternalServerProxyMetadata metadata = new InternalServerProxyMetadata(readTimeout, connectTimeout,
            idleTimeout, maxConnectionsPerAddress, maxConnectionsTotal, maxQueueSizePerAddress, waitingTime,
            numberOfAttempts, retryDelay, hostAndPortPairs, keyStorePath, keyStorePassword, trustStorePath,
            trustStorePassword, followRedirects, autoCloseable, staleConnectionCheckEnabled, disableCookies,
            serviceDirectoryEnabled, serviceName, autoEncodeUri);
    //        metadata.getHostAndPortPairs().addAll(hostAndPortPairs);
    //        metadata.setReadTimeout(readTimeout);
    //        metadata.setConnectTimeout(connectTimeout);
    //        metadata.setNumberOfRetries(numberOfAttempts);
    //        metadata.setRetryDelay(retryDelay);
    //        metadata.setWaitingTime(waitingTime);

    return metadata;

}

From source file:org.wso2.carbon.bpel.core.ode.integration.store.ProcessStoreImpl.java

public void onBPELPackageDeployment(Integer tenantId, final String duName, final String duLocation,
        final List<ProcessConfigurationImpl> processConfs) {
    boolean status = exec(new Callable<Boolean>() {
        @Override/* w  w  w  .j  a  va 2s. c o  m*/
        public Boolean call(ConfStoreConnection conn) {
            DeploymentUnitDAO duDao = conn.getDeploymentUnit(duName);
            if (duDao != null) {
                /*
                This is for clustering scenario. update/deployment
                 */
                return true;
            }

            duDao = conn.createDeploymentUnit(duName);
            duDao.setDeploymentUnitDir(duLocation);

            for (ProcessConf pConf : processConfs) {
                try {
                    ProcessConfDAO processConfDao = duDao.createProcess(pConf.getProcessId(), pConf.getType(),
                            pConf.getVersion());
                    processConfDao.setState(pConf.getState());
                    for (Map.Entry<QName, Node> prop : pConf.getProcessProperties().entrySet()) {
                        processConfDao.setProperty(prop.getKey(), DOMUtils.domToString(prop.getValue()));
                    }
                    conn.setVersion(pConf.getVersion());
                } catch (Exception e) {
                    String errmsg = "Error persisting deployment record for " + pConf.getProcessId()
                            + "; process will not be available after restart!";
                    log.error(errmsg, e);
                    return false;
                }
            }
            return true;
        }
    });

    if (status) {
        CopyOnWriteArrayList<QName> pids = new CopyOnWriteArrayList<QName>();
        for (ProcessConf pConf : processConfs) {
            pids.add(pConf.getProcessId());
        }
        updateProcessAndDUMaps(tenantId, duName, pids, true);

        for (ProcessConfigurationImpl processConf : processConfs) {
            fireEvent(
                    new ProcessStoreEvent(ProcessStoreEvent.Type.DEPLOYED, processConf.getProcessId(), duName));
            fireStateChange(processConf.getProcessId(), processConf.getState(), duName);
        }

    }
}