Skip to content

Commit

Permalink
Usage Server logging and peristance xml improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
twschiller committed Sep 19, 2013
1 parent 76cfdc7 commit ac9d56f
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 38 deletions.
Expand Up @@ -11,11 +11,14 @@
<class>edu.washington.cs.cupid.usage.server.data.CupidUser</class> <class>edu.washington.cs.cupid.usage.server.data.CupidUser</class>
<class>edu.washington.cs.cupid.usage.server.data.SystemData</class> <class>edu.washington.cs.cupid.usage.server.data.SystemData</class>


<exclude-unlisted-classes>true</exclude-unlisted-classes>

<properties> <properties>
<property name="datanucleus.NontransactionalRead" value="true"/> <property name="datanucleus.NontransactionalRead" value="true"/>
<property name="datanucleus.NontransactionalWrite" value="true"/> <property name="datanucleus.NontransactionalWrite" value="true"/>
<property name="datanucleus.ConnectionURL" value="appengine"/> <property name="datanucleus.ConnectionURL" value="appengine"/>
<property name="datanucleus.singletonEMFForName" value="true"/> <property name="datanucleus.singletonEMFForName" value="true"/>
</properties> </properties>
</persistence-unit> </persistence-unit>

</persistence> </persistence>
Expand Up @@ -39,7 +39,12 @@ public class CupidUsageDataServlet extends HttpServlet {
private Gson gson = new Gson(); private Gson gson = new Gson();


private void writeSession(final JsonCupidSession raw){ private void writeSession(final JsonCupidSession raw){
if (raw == null) throw new IllegalArgumentException("Received null session data from client");

log.info("Received data for uuid " + raw.uuid);

EntityManager em = EMFService.get().createEntityManager(); EntityManager em = EMFService.get().createEntityManager();
if (em == null) throw new RuntimeException("Error loading entity manager");


try{ try{
EntityTransaction tx = em.getTransaction(); EntityTransaction tx = em.getTransaction();
Expand Down Expand Up @@ -68,7 +73,10 @@ private void writeSession(final JsonCupidSession raw){
em.persist(user); em.persist(user);


tx.commit(); tx.commit();

log.info("Recorded data for uuid " + raw.uuid);
} catch (RuntimeException ex){ } catch (RuntimeException ex){
log.log(Level.WARNING, "Error recording data for uuid " + raw.uuid, ex);
throw ex; throw ex;
} finally { } finally {
if (tx.isActive()){ if (tx.isActive()){
Expand Down

This file was deleted.

This file was deleted.

Expand Up @@ -10,4 +10,4 @@
# #


# Set the default logging level for all loggers to WARNING # Set the default logging level for all loggers to WARNING
.level = WARNING .level = INFO

0 comments on commit ac9d56f

Please sign in to comment.