Attempt to lower the number of resources consumed while running tests

I keep having too many resource issues while running tests, so bit the bullet and try to cleanup a lot. We no longer consume 2k+ threads, but there is still a lot more work to do.

After this PR, we peak around 240 threads (used to be 2-3k)
Not seen it yet.  This is a cautionary thing.
On Oct 18, 2014 8:45 PM, "Haoyuan Li" <notifications@github.com> wrote:

> In core/src/main/java/tachyon/master/MasterClient.java:
>
> > @@ -116,11 +116,14 @@ public synchronized void close() {
> >        LOG.debug("Disconnecting from the master {}", mMasterAddress);
> >        mConnected = false;
> >      }
> > -    if (mProtocol != null) {
> > -      mProtocol.getTransport().close();
> > -    }
> > -    if (mHeartbeatThread != null) {
> > -      mHeartbeatThread.shutdown();
> > +    try {
> > +      if (mProtocol != null) {
> > +        mProtocol.getTransport().close();
>
> Yes. I'm curious how often did that happen?
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/amplab/tachyon/pull/474/files#r19057777>.
>