diff options
Diffstat (limited to 'lib/jinterface/java_src')
-rw-r--r-- | lib/jinterface/java_src/Makefile | 16 | ||||
-rw-r--r-- | lib/jinterface/java_src/com/ericsson/otp/erlang/OtpEpmd.java | 161 | ||||
-rw-r--r-- | lib/jinterface/java_src/com/ericsson/otp/erlang/OtpMbox.java | 5 | ||||
-rw-r--r-- | lib/jinterface/java_src/pom.xml.src | 106 |
4 files changed, 134 insertions, 154 deletions
diff --git a/lib/jinterface/java_src/Makefile b/lib/jinterface/java_src/Makefile index 37a57352ad..22c55328b8 100644 --- a/lib/jinterface/java_src/Makefile +++ b/lib/jinterface/java_src/Makefile @@ -35,7 +35,21 @@ VSN=$(JINTERFACE_VSN) SPECIAL_TARGETS = +TARGET_FILES= $(POM_TARGET) +SPECIAL_TARGETS = + +POM_FILE= pom.xml + +POM_TARGET= ../$(POM_FILE) +POM_SRC= $(POM_FILE).src + +# ---------------------------------------------------- +# Special Build Targets +# ---------------------------------------------------- + +$(POM_TARGET): $(POM_SRC) ../vsn.mk + sed -e 's;%VSN%;$(VSN);' $< > $@ # ---------------------------------------------------- # Default Subdir Targets @@ -43,7 +57,7 @@ SPECIAL_TARGETS = .PHONY: debug opt instr release docs release_docs tests release_tests clean depend -debug opt instr release docs release_docs tests release_tests clean depend: +debug opt instr release docs release_docs tests release_tests clean depend: $(TARGET_FILES) set -e; set -x; \ case "$(MAKE)" in *clearmake*) tflag="-T";; *) tflag="";; esac; \ if test -f com/ericsson/otp/erlang/ignore_config_record.inf; then xflag=$$tflag; fi; \ diff --git a/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpEpmd.java b/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpEpmd.java index 3bb678c2cc..deac528133 100644 --- a/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpEpmd.java +++ b/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpEpmd.java @@ -1,7 +1,7 @@ /* * %CopyrightBegin% * - * Copyright Ericsson AB 2000-2009. All Rights Reserved. + * Copyright Ericsson AB 2000-2010. All Rights Reserved. * * The contents of this file are subject to the Erlang Public License, * Version 1.1, (the "License"); you may not use this file except in @@ -71,11 +71,6 @@ public class OtpEpmd { // common values private static final byte stopReq = (byte) 115; - // version specific value - private static final byte port3req = (byte) 112; - private static final byte publish3req = (byte) 97; - private static final byte publish3ok = (byte) 89; - private static final byte port4req = (byte) 122; private static final byte port4resp = (byte) 119; private static final byte publish4req = (byte) 120; @@ -123,11 +118,7 @@ public class OtpEpmd { * if there was no response from the name server. */ public static int lookupPort(final AbstractNode node) throws IOException { - try { return r4_lookupPort(node); - } catch (final IOException e) { - return r3_lookupPort(node); - } } /** @@ -147,11 +138,7 @@ public class OtpEpmd { throws IOException { Socket s = null; - try { - s = r4_publish(node); - } catch (final IOException e) { - s = r3_publish(node); - } + s = r4_publish(node); node.setEpmd(s); @@ -196,67 +183,6 @@ public class OtpEpmd { } } - private static int r3_lookupPort(final AbstractNode node) - throws IOException { - int port = 0; - Socket s = null; - - try { - final OtpOutputStream obuf = new OtpOutputStream(); - s = new Socket(node.host(), EpmdPort.get()); - - // build and send epmd request - // length[2], tag[1], alivename[n] (length = n+1) - obuf.write2BE(node.alive().length() + 1); - obuf.write1(port3req); - obuf.writeN(node.alive().getBytes()); - - // send request - obuf.writeTo(s.getOutputStream()); - - if (traceLevel >= traceThreshold) { - System.out.println("-> LOOKUP (r3) " + node); - } - - // receive and decode reply - final byte[] tmpbuf = new byte[100]; - - s.getInputStream().read(tmpbuf); - final OtpInputStream ibuf = new OtpInputStream(tmpbuf, 0); - - port = ibuf.read2BE(); - } catch (final IOException e) { - if (traceLevel >= traceThreshold) { - System.out.println("<- (no response)"); - } - throw new IOException("Nameserver not responding on " + node.host() - + " when looking up " + node.alive()); - } catch (final OtpErlangDecodeException e) { - if (traceLevel >= traceThreshold) { - System.out.println("<- (invalid response)"); - } - throw new IOException("Nameserver not responding on " + node.host() - + " when looking up " + node.alive()); - } finally { - try { - if (s != null) { - s.close(); - } - } catch (final IOException e) { /* ignore close errors */ - } - s = null; - } - - if (traceLevel >= traceThreshold) { - if (port == 0) { - System.out.println("<- NOT FOUND"); - } else { - System.out.println("<- PORT " + port); - } - } - return port; - } - private static int r4_lookupPort(final AbstractNode node) throws IOException { int port = 0; @@ -288,8 +214,6 @@ public class OtpEpmd { final int n = s.getInputStream().read(tmpbuf); if (n < 0) { - // this was an r3 node => not a failure (yet) - s.close(); throw new IOException("Nameserver not responding on " + node.host() + " when looking up " + node.alive()); @@ -342,81 +266,13 @@ public class OtpEpmd { return port; } - private static Socket r3_publish(final OtpLocalNode node) - throws IOException { - Socket s = null; - - try { - final OtpOutputStream obuf = new OtpOutputStream(); - s = new Socket((String) null, EpmdPort.get()); - - obuf.write2BE(node.alive().length() + 3); - - obuf.write1(publish3req); - obuf.write2BE(node.port()); - obuf.writeN(node.alive().getBytes()); - - // send request - obuf.writeTo(s.getOutputStream()); - if (traceLevel >= traceThreshold) { - System.out.println("-> PUBLISH (r3) " + node + " port=" - + node.port()); - } - - final byte[] tmpbuf = new byte[100]; - - final int n = s.getInputStream().read(tmpbuf); - - if (n < 0) { - s.close(); - if (traceLevel >= traceThreshold) { - System.out.println("<- (no response)"); - } - return null; - } - - final OtpInputStream ibuf = new OtpInputStream(tmpbuf, 0); - - if (ibuf.read1() == publish3ok) { - node.creation = ibuf.read2BE(); - if (traceLevel >= traceThreshold) { - System.out.println("<- OK"); - } - return s; // success - don't close socket - } - } catch (final IOException e) { - // epmd closed the connection = fail - if (s != null) { - s.close(); - } - if (traceLevel >= traceThreshold) { - System.out.println("<- (no response)"); - } - throw new IOException("Nameserver not responding on " + node.host() - + " when publishing " + node.alive()); - } catch (final OtpErlangDecodeException e) { - if (s != null) { - s.close(); - } - if (traceLevel >= traceThreshold) { - System.out.println("<- (invalid response)"); - } - throw new IOException("Nameserver not responding on " + node.host() - + " when publishing " + node.alive()); - } - - if (s != null) { - s.close(); - } - return null; // failure - } - /* - * this function will get an exception if it tries to talk to an r3 epmd, or - * if something else happens that it cannot forsee. In both cases we return - * an exception (and the caller should try again, using the r3 protocol). If - * we manage to successfully communicate with an r4 epmd, we return either - * the socket, or null, depending on the result. + * this function will get an exception if it tries to talk to a + * very old epmd, or if something else happens that it cannot + * forsee. In both cases we return an exception. We no longer + * support r3, so the exception is fatal. If we manage to + * successfully communicate with an r4 epmd, we return either the + * socket, or null, depending on the result. */ private static Socket r4_publish(final OtpLocalNode node) throws IOException { @@ -454,7 +310,6 @@ public class OtpEpmd { final int n = s.getInputStream().read(tmpbuf); if (n < 0) { - // this was an r3 node => not a failure (yet) if (s != null) { s.close(); } diff --git a/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpMbox.java b/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpMbox.java index 4146bd3ced..a9712aa2ba 100644 --- a/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpMbox.java +++ b/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpMbox.java @@ -678,6 +678,11 @@ public class OtpMbox { return m.self.equals(self); } + @Override + public int hashCode() { + return self.hashCode(); + } + /* * called by OtpNode to deliver message to this mailbox. * diff --git a/lib/jinterface/java_src/pom.xml.src b/lib/jinterface/java_src/pom.xml.src new file mode 100644 index 0000000000..cef49b735a --- /dev/null +++ b/lib/jinterface/java_src/pom.xml.src @@ -0,0 +1,106 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <groupId>org.erlang.otp</groupId> + <artifactId>jinterface</artifactId> + <packaging>jar</packaging> + <version>%VSN%</version> + <name>jinterface</name> + <description> + Jinterface Java package contains java classes, which help you integrate programs written in Java with Erlang. + Erlang is a programming language designed at the Ericsson Computer Science Laboratory. + </description> + <url>http://erlang.org/</url> + <licenses> + <license> + <name>ERLANG PUBLIC LICENSE 1.1</name> + <url>http://www.erlang.org/EPLICENSE</url> + <distribution>repo</distribution> + </license> + </licenses> + <scm> + <connection>git://github.com/erlang/otp.git</connection> + <developerConnection>git://github.com/erlang/otp.git</developerConnection> + <url>http://github.com/erlang/otp</url> + </scm> + <developers> + <developer> + <email>[email protected]</email> + </developer> + </developers> + <organization> + <name>Open Source Erlang</name> + <url>http://www.erlang.org/</url> + </organization> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <source>1.5</source> + <target>1.5</target> + </configuration> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>build-helper-maven-plugin</artifactId> + <executions> + <execution> + <phase>generate-sources</phase> + <goals> + <goal>add-source</goal> + </goals> + <configuration> + <sources> + <source>java_src</source> + </sources> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> + <distributionManagement> + <repository> + <id>ossrh</id> + <url>http://oss.sonatype.org/service/local/staging/deploy/maven2</url> + </repository> + <snapshotRepository> + <id>ossrh</id> + <url>http://oss.sonatype.org/content/repositories/snapshots</url> + </snapshotRepository> + </distributionManagement> + <profiles> + <profile> + <id>release-sign-artifacts</id> + <activation> + <property> + <name>performRelease</name> + <value>true</value> + </property> + </activation> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-gpg-plugin</artifactId> + <version>1.0-alpha-4</version> + <executions> + <execution> + <id>sign-artifacts</id> + <phase>verify</phase> + <goals> + <goal>sign</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + </profile> + </profiles> + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + </properties> +</project> |