Adaptive Task Selection using Threshold Techniques in Sensor Networks