Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into develop
Browse files Browse the repository at this point in the history
# Conflicts:
#	pi4j-core/src/main/java/com/pi4j/registry/impl/DefaultRuntimeRegistry.java
  • Loading branch information
alex9849 committed Feb 8, 2024
2 parents 134ac9f + 971ad30 commit 00aa156
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 24 deletions.
9 changes: 0 additions & 9 deletions pi4j-core/src/main/java/com/pi4j/registry/Registry.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,6 @@
* @version $Id: $Id
*/
public interface Registry extends Describable {

/**
* <p>exists.</p>
*
* @param id a {@link java.lang.String} object.
* @param type a {@link java.lang.Class} object.
* @return a boolean.
*/
boolean exists(String id, Class<? extends IO> type);
/**
* <p>exists.</p>
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,6 @@ private DefaultRegistry(RuntimeRegistry registry) {
this.registry = registry;
}

/** {@inheritDoc} */
@Override
public boolean exists(String id, Class<? extends IO> type) {
return registry.exists(id, type);
}

/** {@inheritDoc} */
@Override
public boolean exists(String id) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@
*/
public class DefaultRuntimeRegistry implements RuntimeRegistry {

private Logger logger = LoggerFactory.getLogger(this.getClass());
private Runtime runtime = null;
private final Map<String, IO> instances = new ConcurrentHashMap<>();
private final Set<Integer> usedAddresses = ConcurrentHashMap.newKeySet();
private static final Logger logger = LoggerFactory.getLogger(this.getClass());
private Runtime runtime;
private final Map<String, IO> instances;
private final Set<Integer> usedAddresses;

// static singleton instance
/**
Expand All @@ -63,13 +63,12 @@ public static RuntimeRegistry newInstance(Runtime runtime){

// private constructor
private DefaultRuntimeRegistry(Runtime runtime) {
// forbid object construction

// set local runtime reference
this.instances = new ConcurrentHashMap<>();
this.usedAddresses = ConcurrentHashMap.newKeySet();
this.runtime = runtime;
}
}

/** {@inheritDoc} */
@Override
public synchronized RuntimeRegistry add(IO instance) throws IOInvalidIDException, IOAlreadyExistsException {

Expand Down Expand Up @@ -222,5 +221,4 @@ public RuntimeRegistry initialize() throws InitializeException {
// NOTHING TO INITIALIZE
return this;
}

}

0 comments on commit 00aa156

Please sign in to comment.