[JACOB-6] Simplify dsl, remove no longer necessary methodList[] based methods, use composite instead
Project: http://git-wip-us.apache.org/repos/asf/ode-jacob/repo Commit: http://git-wip-us.apache.org/repos/asf/ode-jacob/commit/96d08fba Tree: http://git-wip-us.apache.org/repos/asf/ode-jacob/tree/96d08fba Diff: http://git-wip-us.apache.org/repos/asf/ode-jacob/diff/96d08fba Branch: refs/heads/master Commit: 96d08fbac01772a88024260589d2ed972a5ce20a Parents: 9841cc1 Author: Hadrian Zbarcea <[email protected]> Authored: Mon Jan 13 13:55:17 2014 -0500 Committer: Hadrian Zbarcea <[email protected]> Committed: Mon Jan 13 13:55:17 2014 -0500 ---------------------------------------------------------------------- src/main/java/org/apache/ode/jacob/Jacob.java | 29 ++++++----- .../java/org/apache/ode/jacob/JacobThread.java | 28 ----------- .../java/org/apache/ode/jacob/vpu/JacobVPU.java | 51 -------------------- 3 files changed, 18 insertions(+), 90 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ode-jacob/blob/96d08fba/src/main/java/org/apache/ode/jacob/Jacob.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/ode/jacob/Jacob.java b/src/main/java/org/apache/ode/jacob/Jacob.java index 12fa1d4..cc7570c 100644 --- a/src/main/java/org/apache/ode/jacob/Jacob.java +++ b/src/main/java/org/apache/ode/jacob/Jacob.java @@ -1,6 +1,23 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ package org.apache.ode.jacob; -import java.util.Set; import org.apache.ode.jacob.oo.Channel; import org.apache.ode.jacob.oo.ChannelListener; @@ -58,11 +75,6 @@ public class Jacob { public static void object(boolean replication, ChannelListener methodList) { JacobVPU.activeJacobThread().object(replication, methodList); } - - public static void object(boolean replication, Set<ChannelListener> methodLists) { - JacobVPU.activeJacobThread().object(replication, - methodLists.toArray(new ChannelListener[methodLists.size()])); - } // calculus API @@ -106,10 +118,5 @@ public class Jacob { public static void subscribe(boolean replicate, ChannelRef channel, MessageListener messageListener) throws IllegalArgumentException { JacobVPU.activeJacobThread().subscribe(replicate, channel, messageListener); } - - public static void subscribe(boolean replicate, ChannelRef channel, MessageListener[] messageListeners) throws IllegalArgumentException { - JacobVPU.activeJacobThread().subscribe(replicate, channel, messageListeners); - } - } http://git-wip-us.apache.org/repos/asf/ode-jacob/blob/96d08fba/src/main/java/org/apache/ode/jacob/JacobThread.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/ode/jacob/JacobThread.java b/src/main/java/org/apache/ode/jacob/JacobThread.java index 5d2f9ae..a8be648 100644 --- a/src/main/java/org/apache/ode/jacob/JacobThread.java +++ b/src/main/java/org/apache/ode/jacob/JacobThread.java @@ -72,7 +72,6 @@ public interface JacobThread { public void sendMessage(Message message); public void subscribe(boolean replicate, ChannelRef channel, MessageListener methodList) throws IllegalArgumentException; - public void subscribe(boolean replicate, ChannelRef channel, MessageListener[] methodList) throws IllegalArgumentException; // OO oriented API @@ -130,31 +129,4 @@ public interface JacobThread { */ public void object(boolean replicate, ChannelListener methodList) throws IllegalArgumentException; - /** - * <p> - * Receive a message on a channel, allowing for possible replication. The - * effect of this method is to register a list of listeners (the method list) for a - * message on the channel to consume either one or an infinite number of - * messages on the channel (depending on the value of the - * <code>replicate</code> argument. - * </p> - * - * <p> - * With respect to process terms, the Java expression <code>object(false, x, - * ChannelListener)</code> - * corresponds to the process term <code> x ? { ChannelListener[] }</code>; - * if in the same expression the initial <code>replicate</code> parameter - * were instead set to <code>true</code>, corresponding term would be - * <code> ! x ? { ChannelListener }</code>. - * </p> - * - * @param replicate - * if set the a replication operator is present - * @param methodList - * object representation of the method list - * @throws IllegalArgumentException - * if the method list does not match the channel kind - */ - public void object(boolean reaplicate, ChannelListener[] methodLists) throws IllegalArgumentException; - } http://git-wip-us.apache.org/repos/asf/ode-jacob/blob/96d08fba/src/main/java/org/apache/ode/jacob/vpu/JacobVPU.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/ode/jacob/vpu/JacobVPU.java b/src/main/java/org/apache/ode/jacob/vpu/JacobVPU.java index f93d0bd..c709a95 100644 --- a/src/main/java/org/apache/ode/jacob/vpu/JacobVPU.java +++ b/src/main/java/org/apache/ode/jacob/vpu/JacobVPU.java @@ -337,32 +337,6 @@ public final class JacobVPU { return new ChannelRef(_executionQueue.consumeExport(channelId)); } - public void object(boolean replicate, ChannelListener[] ml) { - if (LOG.isTraceEnabled()) { - StringBuffer msg = new StringBuffer(); - msg.append(_cycle); - msg.append(": "); - for (int i = 0; i < ml.length; ++i) { - if (i != 0) msg.append(" + "); - if (ml[i] instanceof ReceiveProcess) { - ReceiveProcess rp = (ReceiveProcess)ml[i]; - msg.append(rp.getChannel()); - msg.append(" ? "); - msg.append(rp.toString()); - } - } - LOG.debug(msg.toString()); - } - - _statistics.numContinuations++; - - CommGroup grp = new CommGroup(replicate); - for (int i = 0; i < ml.length; ++i) { - addCommChannel(grp, ml[i]); - } - _executionQueue.add(grp); - } - public void object(boolean replicate, ChannelListener ml) { if (LOG.isTraceEnabled()) { StringBuffer msg = new StringBuffer(); @@ -405,31 +379,6 @@ public final class JacobVPU { _executionQueue.add(grp); } - public void subscribe(boolean replicate, ChannelRef channel, MessageListener listeners[]) { - assert channel.getType() == ChannelRef.Type.CHANNEL; - if (LOG.isTraceEnabled()) { - StringBuffer msg = new StringBuffer(); - msg.append(_cycle); - msg.append(": "); - for (int i = 0; i < listeners.length; ++i) { - if (i != 0) msg.append(" + "); - msg.append(channel); - msg.append(" ? "); - msg.append(listeners[i].toString()); - } - LOG.debug(msg.toString()); - } - - _statistics.numContinuations++; - - CommGroup grp = new CommGroup(replicate); - for (int i = 0; i < listeners.length; ++i) { - CommRecv recv = new CommRecv(channel.getEndpoint(CommChannel.class), listeners[i]); - grp.add(recv); - } - _executionQueue.add(grp); - } - private void addCommChannel(CommGroup group, ChannelListener receiver) { if (receiver instanceof CompositeProcess) { for (ChannelListener r : ((CompositeProcess)receiver).getProcesses()) {
