Skip to content

Commit

Permalink
Minor improvements.
Browse files Browse the repository at this point in the history
  • Loading branch information
nmihajlovski committed Jun 11, 2016
1 parent c604ece commit ccbf6cf
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
Expand Up @@ -211,8 +211,10 @@ public static List<Class<?>> findBeans(String... packages) {
return beansCache.get(U.list(packages)); return beansCache.get(U.list(packages));
} }


public static void scan(String... packages) { public static boolean scan(String... packages) {
beans(App.findBeans(packages).toArray()); List<Class<?>> beans = App.findBeans(packages);
beans(beans.toArray());
return !beans.isEmpty();
} }


public static void beans(Object... beans) { public static void beans(Object... beans) {
Expand Down
16 changes: 12 additions & 4 deletions rapidoid-http-server/src/main/java/org/rapidoid/setup/Setup.java
Expand Up @@ -156,10 +156,10 @@ public FastHttp http() {
} }


synchronized (this) { synchronized (this) {
if (isAdmin() && ON.http != null && appAndAdminOnSameServer()) { if (isAdminAndSameAsApp() && ON.http != null) {
return ON.http; return ON.http;


} else if (isApp() && ADMIN.http != null && appAndAdminOnSameServer()) { } else if (isAppAndSameAsAdmin() && ADMIN.http != null) {
return ADMIN.http; return ADMIN.http;
} }


Expand Down Expand Up @@ -205,17 +205,25 @@ public synchronized Server listen() {
} }


private boolean delegateAdminToApp() { private boolean delegateAdminToApp() {
return isAdmin() && ON.server != null && appAndAdminOnSameServer(); return isAdminAndSameAsApp() && ON.server != null;
} }


private boolean delegateAppToAdmin() { private boolean delegateAppToAdmin() {
return isApp() && ADMIN.server != null && appAndAdminOnSameServer(); return isAppAndSameAsAdmin() && ADMIN.server != null;
} }


public static boolean appAndAdminOnSameServer() { public static boolean appAndAdminOnSameServer() {
return U.eq(ADMIN.calcPort(), ON.calcPort()); return U.eq(ADMIN.calcPort(), ON.calcPort());
} }


public boolean isAppAndSameAsAdmin() {
return isApp() && appAndAdminOnSameServer();
}

public boolean isAdminAndSameAsApp() {
return isAdmin() && appAndAdminOnSameServer();
}

public boolean isAdmin() { public boolean isAdmin() {
return this == ADMIN; return this == ADMIN;
} }
Expand Down
@@ -1,3 +1,3 @@
<h1>Welcome to Rapidoid!</h1> <h1>Welcome to Rapidoid!</h1>
<br> <br>
<h4>Your can upload/deploy your application JAR in the <a href="${adminUrl}">Admin Center</a>.</h4> <h4>Your can upload / deploy your application JAR in the <a href="${adminUrl}">Admin Center</a>.</h4>

0 comments on commit ccbf6cf

Please sign in to comment.