Skip to content

Commit

Permalink
TEIID-5351 updating to wildfly 14
Browse files Browse the repository at this point in the history
  • Loading branch information
shawkins committed Oct 18, 2018
1 parent fd03189 commit 0f31f35
Show file tree
Hide file tree
Showing 22 changed files with 121 additions and 123 deletions.
1 change: 1 addition & 0 deletions build/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
<plugin>
<groupId>org.wildfly.build</groupId>
<artifactId>wildfly-server-provisioning-maven-plugin</artifactId>
<!-- See https://github.com/wildfly/wildfly-build-tools/issues/47 -->
<version>1.2.6.Final</version>
<executions>
<execution>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.3" name="org.apache.commons.pool">
<properties>
<property name="jboss.api" value="private"/>
</properties>

<resources>
<artifact name="${commons-pool:commons-pool}"/>
</resources>

</module>
2 changes: 1 addition & 1 deletion connectors/odata/translator-odata/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
</dependency>
<dependency>
<groupId>org.jboss.spec.javax.ws.rs</groupId>
<artifactId>jboss-jaxrs-api_2.0_spec</artifactId>
<artifactId>jboss-jaxrs-api_2.1_spec</artifactId>
</dependency>
</dependencies>

Expand Down
2 changes: 1 addition & 1 deletion connectors/webservice/connector-ws/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
</dependency>
<dependency>
<groupId>org.jboss.spec.javax.ws.rs</groupId>
<artifactId>jboss-jaxrs-api_2.0_spec</artifactId>
<artifactId>jboss-jaxrs-api_2.1_spec</artifactId>
</dependency>
<dependency>
<groupId>net.oauth.core</groupId>
Expand Down
1 change: 1 addition & 0 deletions engine/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>javacc-maven-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>javacc</id>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,7 @@
import java.io.PrintStream;
import java.util.Collection;

import org.jboss.as.cli.CliConfig;
import org.jboss.as.cli.CliEventListener;
import org.jboss.as.cli.CommandContext;
import org.jboss.as.cli.CommandFormatException;
import org.jboss.as.cli.CommandHistory;
import org.jboss.as.cli.CommandLineCompleter;
import org.jboss.as.cli.CommandLineException;
import org.jboss.as.cli.CommandLineRedirection;
import org.jboss.as.cli.ConnectionInfo;
import org.jboss.as.cli.ControllerAddress;
import org.jboss.as.cli.*;
import org.jboss.as.cli.batch.BatchManager;
import org.jboss.as.cli.batch.BatchedCommand;
import org.jboss.as.cli.operation.CommandLineParser;
Expand Down Expand Up @@ -294,4 +285,10 @@ public ModelNode execute(Operation op, String description) throws CommandLineExc
public DMRCommandContext(CommandContext delegate) {
this.delegate = delegate;
}

@Override
public void connectController(String arg0, String arg1)
throws CommandLineException {
this.delegate.connectController(arg0, arg1);
}
}
4 changes: 4 additions & 0 deletions jboss-integration/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@
<groupId>org.wildfly</groupId>
<artifactId>wildfly-clustering-jgroups-api</artifactId>
</dependency>
<dependency>
<groupId>org.wildfly</groupId>
<artifactId>wildfly-clustering-jgroups-spi</artifactId>
</dependency>
<dependency>
<groupId>org.wildfly</groupId>
<artifactId>wildfly-security</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import org.jboss.msc.service.StartException;
import org.jboss.msc.service.StopContext;
import org.jboss.msc.value.InjectedValue;
import org.jgroups.Channel;
import org.jgroups.JChannel;
import org.teiid.replication.jgroups.JGroupsObjectReplicator;
import org.wildfly.clustering.jgroups.ChannelFactory;

Expand All @@ -39,8 +39,8 @@ class JGroupsObjectReplicatorService implements Service<JGroupsObjectReplicator>
public void start(StartContext context) throws StartException {
this.replicator = new JGroupsObjectReplicator(new org.teiid.replication.jgroups.ChannelFactory() {
@Override
public Channel createChannel(String id) throws Exception {
Channel c = channelFactoryInjector.getValue().createChannel(id);
public JChannel createChannel(String id) throws Exception {
JChannel c = channelFactoryInjector.getValue().createChannel(id);
c.connect(id);
return c;
}
Expand Down
5 changes: 2 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>org.teiid</groupId>
<artifactId>project-bom-parent</artifactId>
<version>1.1.2</version>
<version>2.0.0-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand All @@ -24,7 +24,7 @@
<version.release.plugin>2.5</version.release.plugin>
<version.teiid.console>3.1.0</version.teiid.console>

<version.teiid.bom>1.1.2</version.teiid.bom>
<version.teiid.bom>2.0.0-SNAPSHOT</version.teiid.bom>

<!-- project version property overrides go here
this should only be utilized when there is a conflict
Expand Down Expand Up @@ -209,7 +209,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.13</version>
<executions>
<execution>
<id>verify-style</id>
Expand Down
4 changes: 2 additions & 2 deletions rest-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@
</dependency>

<dependency>
<groupId>asm</groupId>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
</dependency>

<dependency>
<groupId>org.jboss.spec.javax.ws.rs</groupId>
<artifactId>jboss-jaxrs-api_2.0_spec</artifactId>
<artifactId>jboss-jaxrs-api_2.1_spec</artifactId>
</dependency>

<dependency>
Expand Down
10 changes: 10 additions & 0 deletions runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,16 @@
<groupId>org.infinispan</groupId>
<artifactId>infinispan-core</artifactId>
</dependency>
<!-- these are excluded from infinispan core in the wildfly parent
but needed to run/test -->
<dependency>
<groupId>com.github.ben-manes.caffeine</groupId>
<artifactId>caffeine</artifactId>
</dependency>
<dependency>
<groupId>io.reactivex.rxjava2</groupId>
<artifactId>rxjava</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.narayana.jta</groupId>
<artifactId>narayana-jta</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
*/
package org.teiid.replication.jgroups;

import org.jgroups.Channel;
import org.jgroups.JChannel;

public interface ChannelFactory {
/**
* Creates a JGroups channel
* @return a JGroups channel
* @throws Exception if there was a failure setting up the protocol stack
*/
Channel createChannel(String id) throws Exception;
JChannel createChannel(String id) throws Exception;
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
import java.util.concurrent.Executor;

import org.jgroups.Address;
import org.jgroups.Channel;
import org.jgroups.JChannel;
import org.jgroups.MembershipListener;
import org.jgroups.Message;
import org.jgroups.MessageListener;
Expand All @@ -51,6 +51,7 @@
import org.jgroups.util.Promise;
import org.jgroups.util.Rsp;
import org.jgroups.util.RspList;
import org.jgroups.util.Util;
import org.teiid.Replicated;
import org.teiid.Replicated.ReplicationMode;
import org.teiid.core.TeiidRuntimeException;
Expand All @@ -73,10 +74,11 @@ private final class ReplicatorRpcDispatcher<S> extends RpcDispatcher {
private final ArrayList<Method> methodList;
Map<List<?>, JGroupsInputStream> inputStreams = new ConcurrentHashMap<List<?>, JGroupsInputStream>();

private ReplicatorRpcDispatcher(Channel channel, MessageListener l,
private ReplicatorRpcDispatcher(JChannel channel, MessageListener l,
MembershipListener l2, Object serverObj, S object,
HashMap<Method, Short> methodMap, ArrayList<Method> methodList) {
super(channel, l, l2, serverObj);
super(channel, serverObj);
this.setMembershipListener(l2);
this.object = object;
this.methodMap = methodMap;
this.methodList = methodList;
Expand All @@ -85,66 +87,53 @@ private ReplicatorRpcDispatcher(Channel channel, MessageListener l,
@Override
public Object handle(Message req) {
Object body=null;
if(server_obj == null) {
log.error(Util.getMessage("NoMethodHandlerIsRegisteredDiscardingRequest"));
return null;
}

if(req == null || req.getLength() == 0) {
if(log.isErrorEnabled()) log.error("message or message buffer is null"); //$NON-NLS-1$
return null;
}

try {
body=req_marshaller != null?
req_marshaller.objectFromBuffer(req.getBuffer(), req.getOffset(), req.getLength())
: req.getObject(getClass().getClassLoader());
}
catch(Throwable e) {
if(log.isErrorEnabled()) log.error("exception marshalling object", e); //$NON-NLS-1$
return e;
}

if(!(body instanceof MethodCall)) {
if(log.isErrorEnabled()) log.error("message does not contain a MethodCall object"); //$NON-NLS-1$

// create an exception to represent this and return it
return new IllegalArgumentException("message does not contain a MethodCall object") ; //$NON-NLS-1$
}

final MethodCall method_call=(MethodCall)body;
if(req == null || req.getLength() == 0) {
log.error(Util.getMessage("MessageOrMessageBufferIsNull"));
return null;
}

try {
MethodCall method_call=methodCallFromBuffer(req.getRawBuffer(), req.getOffset(), req.getLength(), marshaller);

if(log.isTraceEnabled())
log.trace("[sender=" + req.getSrc() + "], method_call: " + method_call); //$NON-NLS-1$ //$NON-NLS-2$

if (method_call.getId() >= methodList.size() - 5 && req.getSrc().equals(local_addr)) {
if (method_call.getMethodId() >= methodList.size() - 5 && req.getSrc().equals(local_addr)) {
return null;
}

if (method_call.getId() >= methodList.size() - 3) {
Serializable address = req.getSrc();
if (method_call.getMethodId() >= methodList.size() - 3) {
Address address = req.getSrc();
Serializable stateId = (Serializable)method_call.getArgs()[0];
List<?> key = Arrays.asList(stateId, address);
JGroupsInputStream is = inputStreams.get(key);
if (method_call.getId() == methodList.size() - 3) {
if (method_call.getMethodId() == methodList.size() - 3) {
LogManager.logTrace(LogConstants.CTX_RUNTIME, object, "create state", stateId); //$NON-NLS-1$
if (is != null) {
is.receive(null);
}
is = new JGroupsInputStream(IO_TIMEOUT);
this.inputStreams.put(key, is);
executor.execute(new StreamingRunner(object, stateId, is, null));
} else if (method_call.getId() == methodList.size() - 2) {
} else if (method_call.getMethodId() == methodList.size() - 2) {
LogManager.logTrace(LogConstants.CTX_RUNTIME, object, "building state", stateId); //$NON-NLS-1$
if (is != null) {
is.receive((byte[])method_call.getArgs()[1]);
}
} else if (method_call.getId() == methodList.size() - 1) {
} else if (method_call.getMethodId() == methodList.size() - 1) {
LogManager.logTrace(LogConstants.CTX_RUNTIME, object, "finished state", stateId); //$NON-NLS-1$
if (is != null) {
is.receive(null);
}
this.inputStreams.remove(key);
}
return null;
} else if (method_call.getId() == methodList.size() - 5) {
} else if (method_call.getMethodId() == methodList.size() - 5) {
//hasState
ReplicatedObject ro = (ReplicatedObject)object;
Serializable stateId = (Serializable)method_call.getArgs()[0];
Expand All @@ -162,7 +151,7 @@ public Object handle(Message req) {
return Boolean.TRUE;
}
return null;
} else if (method_call.getId() == methodList.size() - 4) {
} else if (method_call.getMethodId() == methodList.size() - 4) {
//sendState
ReplicatedObject ro = (ReplicatedObject)object;
String stateId = (String)method_call.getArgs()[0];
Expand All @@ -182,9 +171,9 @@ public Object handle(Message req) {
return null;
}

Method m=method_lookup.findMethod(method_call.getId());
Method m=method_lookup.findMethod(method_call.getMethodId());
if(m == null)
throw new Exception("no method found for " + method_call.getId()); //$NON-NLS-1$
throw new Exception("no method found for " + method_call.getMethodId()); //$NON-NLS-1$
method_call.setMethod(m);

return method_call.invoke(server_obj);
Expand Down Expand Up @@ -324,18 +313,14 @@ protected Address whereIsState(Serializable stateId, long timeout) throws Except
return null;
}
RspList<Boolean> resp = this.disp.callRemoteMethods(getRemoteMembersCopy(), new MethodCall((short)(methodMap.size() - 5), new Object[]{stateId}), new RequestOptions(ResponseMode.GET_ALL, timeout));
Collection<Rsp<Boolean>> values = resp.values();
Rsp<Boolean> rsp = null;
for (Rsp<Boolean> response : values) {
if (Boolean.TRUE.equals(response.getValue())) {
rsp = response;
Address addr = null;
for (Map.Entry<Address, Rsp<Boolean>> response : resp.entrySet()) {
if (Boolean.TRUE.equals(response.getValue().getValue())) {
addr = response.getKey();
break;
}
}
if (rsp == null) {
return null;
}
return rsp.getSender();
return addr;
}

private Object handleReplicateState(Method method, Object[] args,
Expand Down Expand Up @@ -454,7 +439,7 @@ public void viewAccepted(View newView) {
if (object instanceof ReplicatedObject<?> && !remoteMembers.isEmpty()) {
HashSet<Serializable> dropped = new HashSet<Serializable>();
for (Address address : remoteMembers) {
dropped.add(address);
dropped.add(address.toString());
}
((ReplicatedObject<?>)object).droppedMembers(dropped);
}
Expand Down Expand Up @@ -487,7 +472,7 @@ public void stop(Object object) {
return;
}
ReplicatedInvocationHandler<?> handler = (ReplicatedInvocationHandler<?>) Proxy.getInvocationHandler(object);
Channel c = handler.disp.getChannel();
JChannel c = handler.disp.getChannel();
handler.disp.stop();
c.disconnect();
c.close();
Expand All @@ -496,7 +481,7 @@ public void stop(Object object) {
@Override
public <T, S> T replicate(String mux_id,
Class<T> iface, final S object, long startTimeout) throws Exception {
Channel channel = channelFactory.createChannel(mux_id);
JChannel channel = channelFactory.createChannel(mux_id);

// To keep the order of methods same at all the nodes.
TreeMap<String, Method> methods = new TreeMap<String, Method>();
Expand Down Expand Up @@ -553,7 +538,7 @@ public Method findMethod(short id) {
try {
channel.connect(mux_id);
if (object instanceof ReplicatedObject) {
((ReplicatedObject)object).setAddress(channel.getAddress());
((ReplicatedObject)object).setAddress(channel.getAddress().toString());
proxy.pullState(null, null, null, startTimeout, startTimeout != 0?STATE_TIMEOUT:0);
}
success = true;
Expand Down
Loading

0 comments on commit 0f31f35

Please sign in to comment.