Package edu.pdx.cs410J.net
package edu.pdx.cs410J.net
This package contains classes that demonstrates Java's networking and concurrent programming facilities.
Some networking and threading resources:
- The Threads trail of Sun's Java Tutorial
- The networking trail of Sun's Java Tutorial
- General networking information
-
ClassDescriptionThis class demonstrates how concurrent access to a bank account needs to be synchronized in order to guarantee the balance is always correct.A
BackAccount
maintains a integer balance.AChatCommunicator
obtains aSocket
and then creates aChatSpeaker
and aChatListener
that run in their own threads.AChatListener
runs in the background and listens for messages on a socket on localhost.This class represents a message that is passed between twoChatSession
s.This class allows two people to chat.AChatSpeaker
runs in the background and sendsChatMessage
s over aSocket
.ACounter
is something that counts in its own thread.This class demonstrates concurrency in Java by having Big Bird and Mr.A server that waits for aDateClient
to connect to it.A worker thread that waits five seconds before returning the current date.This program dumps the contents of a URL to standard out.This class is used to demonstrate object serialization support for referential integrity.This program starts up a bunch ofWorkingThread
s and also starts anInterruptingThread
that will interrupt eachWorkingThread
after a given number of seconds.This program listens to a socket.Uses aURLClassLoader
to load a resource from a given URL.AMcCustomer
arrives aMcDonalds
and waits for a BigMac.This class models aMcDonalds
.This class represents an employee of aMcDonalds
who makes BigMacs(tm).This class demonstrates object serialization by reading an instance ofDate
from a file.This class demonstrates serialization support for referential integrity by deserializing a graph ofGraphNode
s.ASpeaker
sends strings over aSocket
to aListener
.This class demonstrates obtains a lock before access theBankAccount
.Synchronized methods ensure that the data in the balance is accessed correctly.Transfers money between twoBankAccount
s.This thread will work until and then wait until it is interrupted.Demonstrates serialization by writing an instance ofDate
to a file.This program constructs a graph ofNode
s and serializes them to a file.