Skip to content

Commit

Permalink
minor stuff
Browse files Browse the repository at this point in the history
git-svn-id: http://anonsvn.jboss.org/repos/weld/ri/trunk@554 1c488680-804c-0410-94cd-c6b725194a0e
  • Loading branch information
nickarls committed Dec 18, 2008
1 parent 53839e2 commit e1f42ef
Show file tree
Hide file tree
Showing 10 changed files with 57 additions and 12 deletions.
4 changes: 2 additions & 2 deletions webbeans-ri/src/main/java/org/jboss/webbeans/log/Logging.java
Expand Up @@ -24,7 +24,7 @@ public static Log getLog(String category)
return new LogImpl(category);
}

public static Log getLog(Class clazz)
public static Log getLog(Class<?> clazz)
{
return new LogImpl(clazz.getName());
}
Expand All @@ -34,7 +34,7 @@ static LogProvider getLogProvider(String category, boolean wrapped)
return isLog4JAvailable ? new Log4JProvider(category, wrapped) : new JDKProvider(category, wrapped);
}

public static LogProvider getLogProvider(Class clazz)
public static LogProvider getLogProvider(Class<?> clazz)
{
return getLogProvider(clazz.getName(), false);
}
Expand Down
Expand Up @@ -69,7 +69,7 @@ public void sessionDestroyed(HttpSessionEvent event)
}

/**
* Called when the context is destroyed (application sopped)
* Called when the context is destroyed (application scoped)
*
* @param event The context event
*/
Expand Down
Expand Up @@ -43,11 +43,9 @@ public void commit() throws RollbackException, HeuristicMixedException,
HeuristicRollbackException, SecurityException, IllegalStateException, SystemException
{
log.debug("committing JTA transaction");
boolean success = false;
try
{
delegate.commit();
success = true;
}
finally
{
Expand Down
Expand Up @@ -35,19 +35,35 @@
public class ConcurrentCache<K, V> extends ForwardingMap<K, Future<V>>
{

// The backing map with the value wrapped in a Future instance
private ConcurrentMap<K, Future<V>> map;

/**
* Constructor
*/
public ConcurrentCache()
{
map = new ConcurrentHashMap<K, Future<V>>();
}

/**
* Gets the Future value from the map
*
* @param key The key to look for
* @return The Future instance of the value
*/
@SuppressWarnings("unchecked")
public <T extends V> Future<T> getFuture(K key)
{
return (Future<T>) super.get(key);
}

/**
* Gets a value from the map. Blocks until it is available
*
* @param key The key to look for
* @return The value
*/
@SuppressWarnings("unchecked")
public <T extends V> T getValue(K key)
{
Expand Down Expand Up @@ -80,6 +96,13 @@ public <T extends V> T getValue(K key)
}
}

/**
* Adds an item to the map if it's not already there
* @param key The key to place the item under
* @param callable The item, wrapped in a Callable instance
* @return The item added
*/
@SuppressWarnings("unchecked")
public <E> E putIfAbsent(K key, Callable<E> callable)
{
Expand Down Expand Up @@ -119,12 +142,22 @@ public <E> E putIfAbsent(K key, Callable<E> callable)
}
}

/**
* Gets the delegate map
*
* @return The backing map
*/
@Override
protected Map<K, Future<V>> delegate()
{
return map;
}

/**
* Examines and re-throws an exception
*
* @param e The exception that happened during execution
*/
protected void rethrow(ExecutionException e)
{
if (e.getCause() instanceof RuntimeException)
Expand Down
Expand Up @@ -25,6 +25,7 @@
*
* @author Pete Muir
*/
@SuppressWarnings("unchecked")
public class EnumerationIterator<T> implements Iterator<T>
{
// The enumeration
Expand Down
@@ -1,9 +1,8 @@
package org.jboss.webbeans.test.ejb.invalid;

import javax.ejb.Singleton;
import javax.webbeans.RequestScoped;

import org.jboss.webbeans.test.annotations.Singleton;

@Singleton
@RequestScoped
public class Greyhound
Expand Down
@@ -1,8 +1,8 @@
package org.jboss.webbeans.test.ejb.invalid;

import javax.ejb.Singleton;
import javax.webbeans.ConversationScoped;

import org.jboss.webbeans.test.annotations.Singleton;

@Singleton
@ConversationScoped
Expand Down
@@ -1,9 +1,8 @@
package org.jboss.webbeans.test.ejb.invalid;

import javax.ejb.Singleton;
import javax.webbeans.SessionScoped;

import org.jboss.webbeans.test.annotations.Singleton;

@Singleton
@SessionScoped
public class IrishTerrier
Expand Down
@@ -0,0 +1,14 @@
package org.jboss.webbeans.test.ejb.valid;

import javax.ejb.Remove;
import javax.ejb.Stateful;
import javax.webbeans.Destructor;

@Stateful
public class GoodDoggie
{
@Destructor @Remove
public void bye() {
}

}
Expand Up @@ -28,14 +28,15 @@ public MockEjbDescriptor(final Class<T> type)
this.type = type;
this.ejbName = type.getSimpleName();
this.localInterfaces = new ArrayList<BusinessInterfaceDescriptor<?>>();
for (final Class<Object> clazz : type.getInterfaces())
for (final Class<?> clazz : type.getInterfaces())
{
localInterfaces.add(new BusinessInterfaceDescriptor<Object>()
{

@SuppressWarnings("unchecked")
public Class<Object> getInterface()
{
return clazz;
return (Class<Object>) clazz;
}

public String getJndiName()
Expand Down

0 comments on commit e1f42ef

Please sign in to comment.